[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d4409486-7b3e-5b59-3b4e-9e832a7c98d5@xen0n.name>
Date: Tue, 28 Mar 2023 15:52:50 +0800
From: WANG Xuerui <kernel@...0n.name>
To: Daniel Borkmann <daniel@...earbox.net>,
George Guo <guodongtai@...inos.cn>
Cc: ast@...nel.org, bpf@...r.kernel.org, chenhuacai@...nel.org,
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 2023/3/28 15:22, Daniel Borkmann wrote:
> 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.
>>
>> <snip>
>>
>> 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.
I can confirm there's currently no speculation barrier equivalent on
lonogarch. (Loongson says there are builtin mitigations for Spectre-V1
and V2 on their chips, and AFAIK efforts to port the exploits to
mips/loongarch have all failed a few years ago.)
And yes I'd agree with removing the warning altogether. Thanks for the
reviews!
Acked-by: WANG Xuerui <git@...0n.name>
>
>> default:
>> pr_err("bpf_jit: unknown opcode %02x\n", code);
>> return -EINVAL;
>>
>
--
WANG "xen0n" Xuerui
Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/
Powered by blists - more mailing lists