From: sashiko-bot@kernel.org
To: "Tiezhu Yang" <yangtiezhu@loongson.cn>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v7 2/2] bpf: Reject programs with inlined helpers if JIT is unavailable
Date: Thu, 02 Jul 2026 14:57:24 +0000 [thread overview]
Message-ID: <20260702145726.0B96B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260702143656.28845-3-yangtiezhu@loongson.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The patch prevents loading BPF programs that use JIT-inlined helpers (e.g., `bpf_get_smp_processor_id`) when the BPF JIT is explicitly disabled at load time (`net.core.bpf_jit_enable=0`).
--
commit 01713d8606e656f4dadefe493f371f4c861d842b
Author: Tiezhu Yang <yangtiezhu@loongson.cn>
bpf: Reject programs with inlined helpers if JIT is unavailable
This patch sets the jit_required flag to 1 when a BPF program uses helpers
that are expected to be inlined by the JIT compiler. This prevents a kernel
panic in the BPF interpreter by rejecting the program with -ENOTSUPP if
JIT compilation is unavailable at runtime.
> diff --git a/kernel/bpf/fixups.c b/kernel/bpf/fixups.c
> index 12a8a4eb757f1..94e0457a0aa33 100644
> --- a/kernel/bpf/fixups.c
> +++ b/kernel/bpf/fixups.c
> @@ -1841,8 +1841,10 @@ int bpf_do_misc_fixups(struct bpf_verifier_env *env)
> }
>
> /* Skip inlining the helper call if the JIT does it. */
> - if (bpf_jit_inlines_helper_call(insn->imm))
> + if (bpf_jit_inlines_helper_call(insn->imm)) {
> + prog->jit_required = 1;
> goto next_insn;
> + }
[Severity: High]
While this correctly prevents the interpreter panic, does this unconditionally
reject valid BPF programs when the JIT is explicitly disabled at load time
(e.g., net.core.bpf_jit_enable=0)?
If this block checked prog->jit_requested before skipping the fixup and
setting jit_required, wouldn't the verifier properly patch the instruction
when JIT is disabled, allowing the program to execute successfully in the
interpreter?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260702143656.28845-1-yangtiezhu@loongson.cn?part=2
next prev parent reply other threads:[~2026-07-02 14:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 14:36 [PATCH bpf-next v7 0/2] Introduce jit_required to prevent a kernel panic Tiezhu Yang
2026-07-02 14:36 ` [PATCH bpf-next v7 1/2] bpf: Introduce jit_required flag and refactor kfunc path Tiezhu Yang
2026-07-02 14:58 ` sashiko-bot
2026-07-03 2:57 ` Tiezhu Yang
2026-07-03 5:24 ` Leon Hwang
2026-07-03 6:59 ` Tiezhu Yang
2026-07-03 14:14 ` Leon Hwang
2026-07-03 15:53 ` Tiezhu Yang
2026-07-04 1:17 ` KaFai Wan
2026-07-03 13:51 ` KaFai Wan
2026-07-03 15:56 ` Tiezhu Yang
2026-07-04 3:23 ` KaFai Wan
2026-07-03 13:55 ` KaFai Wan
2026-07-03 16:14 ` Tiezhu Yang
2026-07-04 1:57 ` KaFai Wan
2026-07-04 2:05 ` KaFai Wan
2026-07-02 14:36 ` [PATCH bpf-next v7 2/2] bpf: Reject programs with inlined helpers if JIT is unavailable Tiezhu Yang
2026-07-02 14:57 ` sashiko-bot [this message]
2026-07-03 4:14 ` Tiezhu Yang
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=20260702145726.0B96B1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yangtiezhu@loongson.cn \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox