All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tiezhu Yang" <yangtiezhu@loongson.cn>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v7 1/2] bpf: Introduce jit_required flag and refactor kfunc path
Date: Thu, 02 Jul 2026 14:58:54 +0000	[thread overview]
Message-ID: <20260702145855.07C6B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260702143656.28845-2-yangtiezhu@loongson.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The `bpf_fixup_call_args()` function and `bpf_prog_has_kfunc_call()` macro were not updated to use the new `jit_required` flag, leading to inconsistent interpreter fallback behavior for pruned kfuncs.
--

commit 5a3f8861c2b6916fe194f97a407cb7265f545fd0
Author: Tiezhu Yang <yangtiezhu@loongson.cn>

bpf: Introduce jit_required flag and refactor kfunc path

Introduce a 'jit_required' bitfield flag at the end of the
flags group in struct bpf_prog. This bit tracks whether a
program strictly requires the JIT compiler.

> diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
> index 649cce41e13f3..5fcd19ccb41a9 100644
> --- a/kernel/bpf/core.c
> +++ b/kernel/bpf/core.c
> @@ -2619,8 +2619,7 @@ struct bpf_prog *__bpf_prog_select_runtime(struct bpf_verifier_env *env, struct
>  	if (fp->bpf_func)
>  		goto finalize;
>  
> -	if (IS_ENABLED(CONFIG_BPF_JIT_ALWAYS_ON) ||
> -	    bpf_prog_has_kfunc_call(fp))
> +	if (IS_ENABLED(CONFIG_BPF_JIT_ALWAYS_ON) || fp->jit_required)
>  		jit_needed = true;
>  
>  	if (!bpf_prog_select_interpreter(fp))

[Severity: Medium]
Since bpf_prog_has_kfunc_call() was replaced here with fp->jit_required,
should bpf_fixup_call_args() in kernel/bpf/fixups.c also be updated to use
the new flag?

Currently, bpf_fixup_call_args() still calls bpf_prog_has_kfunc_call(). If
a program has a pruned kfunc (allocating kfunc_tab but leaving
jit_required=0) and JIT falls back to the interpreter, wouldn't
bpf_fixup_call_args() incorrectly reject the program with -EINVAL?

kernel/bpf/fixups.c:bpf_fixup_call_args() {
    ...
	bool has_kfunc_call = bpf_prog_has_kfunc_call(prog);
    ...
	if (has_kfunc_call) {
		verbose(env, "calling kernel functions are not allowed in non-JITed programs\n");
		return -EINVAL;
	}
    ...
}

Should bpf_prog_has_kfunc_call() in kernel/bpf/verifier.c be updated to
check prog->jit_required, or removed entirely in favor of checking the flag
directly?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260702143656.28845-1-yangtiezhu@loongson.cn?part=1

  reply	other threads:[~2026-07-02 14:58 UTC|newest]

Thread overview: 23+ 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 [this message]
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-06  0:56         ` Tiezhu Yang
2026-07-06  3:59           ` Leon Hwang
2026-07-06  4:27             ` Tiezhu Yang
2026-07-06 10:58             ` 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
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=20260702145855.07C6B1F000E9@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 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.