[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250828020135.248869-1-yangfeng59949@163.com>
Date: Thu, 28 Aug 2025 10:01:35 +0800
From: Feng Yang <yangfeng59949@....com>
To: ast@...nel.org,
daniel@...earbox.net,
john.fastabend@...il.com,
andrii@...nel.org,
martin.lau@...ux.dev,
eddyz87@...il.com,
song@...nel.org,
yonghong.song@...ux.dev,
kpsingh@...nel.org,
sdf@...ichev.me,
haoluo@...gle.com,
jolsa@...nel.org
Cc: bpf@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org,
llvm@...ts.linux.dev
Subject: [PATCH v2 bpf-next] selftests/bpf: Fix the invalid operand for instruction issue
From: Feng Yang <yangfeng@...inos.cn>
The following issue occurs when compiling with clang version 17.0.6:
progs/compute_live_registers.c:251:3: error: invalid operand for instruction
251 | "r0 = 1;"
| ^
<inline asm>:1:22: note: instantiated into assembly here
1 | r0 = 1;r2 = 2;if r1 & 0x7 goto +1;exit;r0 = r2;exit;
| ^
1 error generated.
Use __imm_insn to fix this issue.
Fixes: 4a4b84ba9e453 ("selftests/bpf: verify jset handling in CFG computation")
Signed-off-by: Feng Yang <yangfeng@...inos.cn>
---
Changes in v2:
- Use __imm_insn, thanks: Eduard Zingerman.
- Link to v1: https://lore.kernel.org/all/20250827031540.461017-1-yangfeng59949@163.com/
---
tools/testing/selftests/bpf/progs/compute_live_registers.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/progs/compute_live_registers.c b/tools/testing/selftests/bpf/progs/compute_live_registers.c
index 6884ab99a421..01d73ad76faf 100644
--- a/tools/testing/selftests/bpf/progs/compute_live_registers.c
+++ b/tools/testing/selftests/bpf/progs/compute_live_registers.c
@@ -249,11 +249,13 @@ __naked void if3_jset_bug(void)
asm volatile (
"r0 = 1;"
"r2 = 2;"
- "if r1 & 0x7 goto +1;"
+ ".8byte %[jset];" /* same as 'if r1 & 0x7 goto +1;' */
"exit;"
"r0 = r2;"
"exit;"
- ::: __clobber_all);
+ :
+ : __imm_insn(jset, BPF_JMP_IMM(BPF_JSET, BPF_REG_1, 0x7, 1))
+ : __clobber_all);
}
SEC("socket")
--
2.43.0
Powered by blists - more mailing lists