Re: [PATCH v5 3/6] selftest/bpf: Fixing powerpc JIT disassembly failure
From: bot+bpf-ci@kernel.org
Date: 2026-05-19 20:14:04
Also in:
bpf, linux-kselftest, stable
quoted hunk ↗ jump to hunk
diff --git a/tools/testing/selftests/bpf/jit_disasm_helpers.c b/tools/testing/selftests/bpf/jit_disasm_helpers.c index 364c557c5115..9e6613479145 100644 --- a/tools/testing/selftests/bpf/jit_disasm_helpers.c +++ b/tools/testing/selftests/bpf/jit_disasm_helpers.c@@ -170,9 +170,11 @@ int get_jited_program_text(int fd, char *text, size_t text_sz) struct bpf_prog_info info = {}; __u32 info_len = sizeof(info); __u32 jited_funcs, len, pc; + __u32 trunc_len = 0; __u32 *func_lens = NULL; FILE *text_out = NULL; uint8_t *image = NULL; + char *triple = NULL; int i, err = 0; if (!llvm_initialized) {@@ -216,9 +218,21 @@ int get_jited_program_text(int fd, char *text, size_t text_sz) if (!ASSERT_OK(err, "bpf_prog_get_info_by_fd #2")) goto out; + /* + * last 8 bytes contains dummy_trampoline address in JIT + * output for 64-bit and 32-bit powerpc, which can't + * disassemble a to valid instruction. + */
This isn't a bug, but there's a grammar error here: "disassemble a to valid instruction" should be "disassemble to a valid instruction".
+ triple = LLVMGetDefaultTargetTriple();
+ if (triple) {
+ if (strstr(triple, "powerpc"))
+ trunc_len = 8;Will this remove a valid instruction on 32-bit PowerPC targets? The dummy trampoline address is stored as an unsigned long, which occupies 8 bytes on 64-bit PowerPC, but only 4 bytes on 32-bit PowerPC. Because the long branch stub ends with a 4-byte bctr instruction followed by the dummy address, unconditionally truncating 8 bytes on 32-bit PowerPC would remove both the 4-byte dummy address and the valid 4-byte bctr instruction from the disassembly. Does the truncation length need to be determined dynamically based on whether the target is 32-bit or 64-bit? (Note: This concern was raised by sashiko-bot@kernel.org in v4: https://lore.kernel.org/bpf/20260517183846.CD7C2C2BCB0@smtp.kernel.org (local))
+ LLVMDisposeMessage(triple);
+ }
+
for (pc = 0, i = 0; i < jited_funcs; ++i) {
fprintf(text_out, "func #%d:\n", i);
- disasm_one_func(text_out, image + pc, func_lens[i]);
+ disasm_one_func(text_out, image + pc, func_lens[i] - trunc_len);
fprintf(text_out, "\n");
pc += func_lens[i];
}--- AI reviewed your patch. Please fix the bug or email reply why it's not a bug. See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md CI run summary: https://github.com/kernel-patches/bpf/actions/runs/26121409898