[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230328071335.2664966-1-guodongtai@kylinos.cn>
Date: Tue, 28 Mar 2023 15:13:35 +0800
From: George Guo <guodongtai@...inos.cn>
To: daniel@...earbox.net
Cc: ast@...nel.org, bpf@...r.kernel.org, chenhuacai@...nel.org,
guodongtai@...inos.cn, 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
Subject: [PATCH v2] loongarch/bpf: Skip speculation barrier opcode, which caused ltp testcase bpf_prog02 to fail
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;
+
default:
pr_err("bpf_jit: unknown opcode %02x\n", code);
return -EINVAL;
--
2.34.1
Powered by blists - more mailing lists