From: sashiko-bot@kernel.org
To: "Saket Kumar Bhaskar" <skb99@linux.ibm.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH v10 7/8] powerpc/bpf: fix buffer overflow in JIT for large BPF programs
Date: Wed, 05 Aug 2026 06:16:50 +0000 [thread overview]
Message-ID: <20260805061651.390E71F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <45cfcf00a9ca1ec0a06c516fabc73e284d529dc1.1785906979.git.skb99@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Inverted pass condition in `bpf_add_extable_entry()` causes JIT compilation failure and stale exception tables.
--
--- Patch [7]: [PATCH v10 7/8] powerpc/bpf: fix buffer overflow in JIT for large BPF programs ---
commit 7c6fc2cfb9f061eb19bae10ea234d06c7a76903c
Author: Abhishek Dubey <adubey@linux.ibm.com>
powerpc/bpf: fix buffer overflow in JIT for large BPF programs
This commit modifies the code-generation loop to iterate until the program size
converges, bounded by CODEGEN_MAX_PASSES, to prevent buffer overflows during JIT
compilation of large BPF programs. It also ensures exit_addr is non-zero before
treating it as in-range and resets alt_exit_addr before subsequent passes.
Link: https://lore.kernel.org/bpf/20260529015855.364704-2-adubey@linux.ibm.com/T/#mfcb23909d977b949727cca4f59ee56a13fd69b92
> diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
> index 8be5ded13a4a6..3c20bb13cfd70 100644
> --- a/arch/powerpc/net/bpf_jit_comp.c
> +++ b/arch/powerpc/net/bpf_jit_comp.c
[ ... ]
> @@ -428,7 +446,7 @@ int bpf_add_extable_entry(struct bpf_prog *fp, u32 *image, u32 *fimage, int pass
> u32 *fixup;
>
> /* Populate extable entries only in the last pass */
> - if (pass != 2)
> + if (pass >= CODEGEN_MIN_PASSES)
> return 0;
>
> if (!fp->aux->extable ||
[Severity: High]
Does this accidentally invert the logic for populating the exception table?
The comment says to populate extable entries only in the last pass, but returning 0
when pass >= CODEGEN_MIN_PASSES means it will skip the final code generation passes
and instead execute during the early passes.
During the scouting pass 0 in bpf_int_jit_compile(), pass >= CODEGEN_MIN_PASSES
evaluates to false, causing it to fall through. Since the exception table
is not yet allocated at this stage, bpf_add_extable_entry() returns -EINVAL
and unconditionally fails JIT compilation for any BPF program with exceptions.
Additionally, for programs taking the extra_pass path, this would cause the extable
population to be skipped during the final passes. Because instructions can shrink
between passes, this might leave stale extable offsets that point to incorrect
locations, which could trigger a kernel panic during unhandled page faults.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1785906979.git.skb99@linux.ibm.com?part=7
next prev parent reply other threads:[~2026-08-05 6:16 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1785906979.git.skb99@linux.ibm.com>
2026-08-05 6:06 ` [PATCH v10 1/8] powerpc/bpf: fix alignment of long branch trampoline address Saket Kumar Bhaskar
2026-08-05 6:21 ` sashiko-bot
2026-08-06 17:15 ` Hari Bathini
2026-08-05 6:06 ` [PATCH v10 2/8] powerpc/bpf: Move out dummy_tramp_addr after Long branch stub Saket Kumar Bhaskar
2026-08-06 17:18 ` Hari Bathini
2026-08-05 6:06 ` [PATCH v10 3/8] selftest/bpf: Fixing powerpc JIT disassembly failure Saket Kumar Bhaskar
2026-08-05 7:37 ` bot+bpf-ci
2026-08-06 17:19 ` Hari Bathini
2026-08-06 17:20 ` Hari Bathini
2026-08-05 6:07 ` [PATCH v10 4/8] selftest/bpf: Enable verifier selftest for powerpc64 Saket Kumar Bhaskar
2026-08-05 7:07 ` bot+bpf-ci
2026-08-06 17:22 ` Hari Bathini
2026-08-05 6:07 ` [PATCH v10 5/8] powerpc64/bpf: fix compare instruction emitted for tailcall Saket Kumar Bhaskar
2026-08-06 17:24 ` Hari Bathini
2026-08-05 6:07 ` [PATCH v10 6/8] selftest/bpf: Add tailcall verifier selftest for powerpc64 Saket Kumar Bhaskar
2026-08-05 6:14 ` sashiko-bot
2026-08-05 6:07 ` [PATCH v10 7/8] powerpc/bpf: fix buffer overflow in JIT for large BPF programs Saket Kumar Bhaskar
2026-08-05 6:16 ` sashiko-bot [this message]
2026-08-05 7:22 ` bot+bpf-ci
2026-08-06 17:26 ` Hari Bathini
2026-08-05 6:07 ` [PATCH v10 8/8] powerpc64/bpf: fix percpu private stack leak on JIT failure Saket Kumar Bhaskar
2026-08-05 6:18 ` sashiko-bot
2026-08-06 17:27 ` Hari Bathini
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=20260805061651.390E71F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=skb99@linux.ibm.com \
/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.