mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: WANG Xuerui <kernel@xen0n.name>, George Guo <guodongtai@kylinos.cn>
Cc: ast@kernel.org, bpf@vger.kernel.org, chenhuacai@kernel.org,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	loongarch@lists.linux.dev, masahiroy@kernel.org,
	michal.lkml@markovi.net, ndesaulniers@google.com,
	hengqi.chen@gmail.com, yangtiezhu@loongson.cn,
	tangyouling@loongson.cn
Subject: Re: [PATCH v2] loongarch/bpf: Skip speculation barrier opcode, which caused ltp testcase bpf_prog02 to fail
Date: Tue, 28 Mar 2023 10:37:36 +0200	[thread overview]
Message-ID: <a8640220-4555-7f14-b1d3-deaaae587331@iogearbox.net> (raw)
In-Reply-To: <d4409486-7b3e-5b59-3b4e-9e832a7c98d5@xen0n.name>

On 3/28/23 9:52 AM, WANG Xuerui wrote:
> 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@xen0n.name>

Ok, sounds good. I've cleaned this up and applied to bpf tree. Thanks!

https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/commit/?id=a6f6a95f25803500079513780d11a911ce551d76

      reply	other threads:[~2023-03-28  8:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-26  4:40 [PATCH] loongarch/bpf: Fix bpf load failed with CONFIG_BPF_JIT_ALWAYS_ON, caused by jit (BPF_ST | BPF_NOSPEC) code George Guo
2023-03-27  9:29 ` Daniel Borkmann
2023-03-28  7:13   ` [PATCH v2] loongarch/bpf: Skip speculation barrier opcode, which caused ltp testcase bpf_prog02 to fail George Guo
2023-03-28  7:22     ` Daniel Borkmann
2023-03-28  7:52       ` WANG Xuerui
2023-03-28  8:37         ` Daniel Borkmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a8640220-4555-7f14-b1d3-deaaae587331@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=guodongtai@kylinos.cn \
    --cc=hengqi.chen@gmail.com \
    --cc=kernel@xen0n.name \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=ndesaulniers@google.com \
    --cc=tangyouling@loongson.cn \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®