From: sashiko-bot@kernel.org
To: adubey@linux.ibm.com
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH v4 3/5] selftest/bpf: Fixing powerpc JIT disassembly failure
Date: Sun, 17 May 2026 18:38:46 +0000 [thread overview]
Message-ID: <20260517183846.CD7C2C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260517214043.12975-4-adubey@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Truncating 8 bytes on 32-bit PowerPC incorrectly removes a valid instruction from the JIT disassembly output.
--
commit 1ee8cba34b15e2d991f046b6802fda4443b02cd0
Author: Abhishek Dubey <adubey@linux.ibm.com>
selftest/bpf: Fixing powerpc JIT disassembly failure
This commit truncates the last 8 bytes from JITed buffers on PowerPC
architectures prior to disassembly in the BPF selftests. This is intended
to prevent the disassembler from misinterpreting a trailing dummy
trampoline address as a valid instruction.
> diff --git a/tools/testing/selftests/bpf/jit_disasm_helpers.c b/tools/testing/selftests/bpf/jit_disasm_helpers.c
> --- a/tools/testing/selftests/bpf/jit_disasm_helpers.c
> +++ b/tools/testing/selftests/bpf/jit_disasm_helpers.c
[ ... ]
> @@ -216,9 +218,18 @@ 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.
> + */
> + triple = LLVMGetDefaultTargetTriple();
> + 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?
> 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);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260517214043.12975-1-adubey@linux.ibm.com?part=3
next prev parent reply other threads:[~2026-05-17 18:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-17 21:40 [PATCH v4 0/5] powerpc/bpf: Add support for verifier selftest adubey
2026-05-17 21:40 ` [PATCH v4 1/5] powerpc/bpf: fix alignment of long branch trampoline address adubey
2026-05-17 18:02 ` sashiko-bot
2026-05-17 18:30 ` bot+bpf-ci
2026-05-18 7:18 ` Hari Bathini
2026-05-17 21:40 ` [PATCH v4 2/5] powerpc/bpf: Move out dummy_tramp_addr after Long branch stub adubey
2026-05-17 18:23 ` sashiko-bot
2026-05-17 18:30 ` bot+bpf-ci
2026-05-18 7:25 ` Hari Bathini
2026-05-18 7:53 ` Hari Bathini
2026-05-17 21:40 ` [PATCH v4 3/5] selftest/bpf: Fixing powerpc JIT disassembly failure adubey
2026-05-17 18:18 ` bot+bpf-ci
2026-05-17 18:38 ` sashiko-bot [this message]
2026-05-17 21:40 ` [PATCH v4 4/5] selftest/bpf: Enable verifier selftest for powerpc64 adubey
2026-05-17 18:18 ` bot+bpf-ci
2026-05-17 21:40 ` [PATCH v4 5/5] selftest/bpf: Add tailcall " adubey
2026-05-17 19:14 ` sashiko-bot
2026-05-18 11:44 ` [PATCH v4 0/5] powerpc/bpf: Add support for verifier selftest Christophe Leroy (CS GROUP)
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=20260517183846.CD7C2C2BCB0@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=adubey@linux.ibm.com \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.