lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ddb2f552-252f-4533-469b-31044b4fc2d6@iogearbox.net>
Date:   Tue, 28 Mar 2023 09:22:24 +0200
From:   Daniel Borkmann <daniel@...earbox.net>
To:     George Guo <guodongtai@...inos.cn>
Cc:     ast@...nel.org, bpf@...r.kernel.org, chenhuacai@...nel.org,
        kernel@...0n.name, linux-kbuild@...r.kernel.org,
        linux-kernel@...r.kernel.org, loongarch@...ts.linux.dev,
        masahiroy@...nel.org, michal.lkml@...kovi.net,
        ndesaulniers@...gle.com, hengqi.chen@...il.com,
        yangtiezhu@...ngson.cn, tangyouling@...ngson.cn
Subject: Re: [PATCH v2] loongarch/bpf: Skip speculation barrier opcode, which
 caused ltp testcase bpf_prog02 to fail

On 3/28/23 9:13 AM, George Guo wrote:
> Here just skip the opcode(BPF_ST | BPF_NOSPEC) that has no couterpart to the loongarch.
> 
> To verify, use ltp testcase:
> 
> Without this patch:
> $ ./bpf_prog02
> ... ...
> bpf_common.c:123: TBROK: Failed verification: ??? (524)
> 
> Summary:
> passed   0
> failed   0
> broken   1
> skipped  0
> warnings 0
> 
> With this patch:
> $ ./bpf_prog02
> ... ...
> Summary:
> passed   0
> failed   0
> broken   0
> skipped  0
> warnings 0
> 
> Signed-off-by: George Guo <guodongtai@...inos.cn>
> 
> ---
> Changelog:
> v2:
> 	- place it to build_insn
> 	- add printing for skipping bpf_jit the opcode
> ---
>   arch/loongarch/net/bpf_jit.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c
> index 288003a9f0ca..d3c6b1c4ccbb 100644
> --- a/arch/loongarch/net/bpf_jit.c
> +++ b/arch/loongarch/net/bpf_jit.c
> @@ -1022,6 +1022,11 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext
>   		emit_atomic(insn, ctx);
>   		break;
>   
> +	/* Speculation barrier */
> +	case BPF_ST | BPF_NOSPEC:
> +		pr_info_once("bpf_jit: skip speculation barrier opcode %0x2x\n", code);
> +		break;

Thanks that looks better. Question to LoongArch folks (Cc): There is no equivalent
to a speculation barrier here, correct? Either way, I think the pr_info_once() can
just be removed given there is little value for a users to have this in the kernel
log. I can take care of this while applying, that's fine.

>   	default:
>   		pr_err("bpf_jit: unknown opcode %02x\n", code);
>   		return -EINVAL;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ