From: Eduard Zingerman <eddyz87@gmail.com>
To: Tiezhu Yang <yangtiezhu@loongson.cn>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>,
Emil Tsalapatis <emil@etsalapatis.com>,
KaFai Wan <kafai.wan@linux.dev>
Cc: bpf@vger.kernel.org, loongarch@lists.linux.dev,
"Leon Hwang" <leon.hwang@linux.dev>,
"Puranjay Mohan" <puranjay@kernel.org>,
"Björn Töpel" <bjorn@kernel.org>
Subject: Re: [PATCH bpf-next v8 2/2] bpf: Reject programs with inlined helpers if JIT is not available
Date: Tue, 07 Jul 2026 10:55:35 -0700 [thread overview]
Message-ID: <792983909e60289981e08026fe810e03a73f4f73.camel@gmail.com> (raw)
In-Reply-To: <450340cb-26a4-d3b2-4861-3016f0a08b13@loongson.cn>
On Tue, 2026-07-07 at 18:39 +0800, Tiezhu Yang wrote:
[...]
> Hi Eduard,
>
> Sorry for the misunderstanding.
> Your wrapper handles the load-time JIT-disabled case nicely.
>
> The problem is, it cannot protect against the case where JIT
> is enabled during verification but dynamically fails later.
>
> In that scenario, the verifier would have already skipped the
> rewrite based on the wrapper, and the fallback to interpreter
> would still trigger the kernel panic.
I'm not sure I understand what you mean. The decision on whether to
use jit for a specific program should be taken at the beginning of the
load system call processing. bpf_prog_alloc_no_stats() sets the
fp->jit_requested before the bpf_check() call in core.c:bpf_prog_load()
and that should be a final say.
At no point the program should be processed with bpf_check() assuming
that jit is enabled and runtime is selected assuming that jit is
disabled. If there are such instances now, these should be addressed.
> By using the 'jit_required' flag, we can cleanly catch both
> cases, and reject early or return -ENOTSUPP at runtime.
>
> Please see the test log for the detailed fallback behaviors:
> https://lore.kernel.org/loongarch/aa26b3fc-9717-4273-dd76-a0dd6b15ff61@loongson.cn/
>
> Since you mentioned it "might as well land as-is", I will
> proceed with v9 using this flag architecture.
>
> Thanks,
> Tiezhu
next prev parent reply other threads:[~2026-07-07 17:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 4:00 [PATCH bpf-next v8 0/2] Introduce jit_required to prevent a kernel panic Tiezhu Yang
2026-07-06 4:00 ` [PATCH bpf-next v8 1/2] bpf: Introduce jit_required flag and remove bpf_prog_has_kfunc_call() Tiezhu Yang
2026-07-06 11:39 ` KaFai Wan
2026-07-07 1:43 ` Tiezhu Yang
2026-07-06 4:00 ` [PATCH bpf-next v8 2/2] bpf: Reject programs with inlined helpers if JIT is not available Tiezhu Yang
2026-07-06 21:41 ` Eduard Zingerman
2026-07-07 1:37 ` Tiezhu Yang
2026-07-07 9:13 ` Eduard Zingerman
2026-07-07 10:39 ` Tiezhu Yang
2026-07-07 17:55 ` Eduard Zingerman [this message]
2026-07-07 2:03 ` Leon Hwang
2026-07-07 9:27 ` Eduard Zingerman
2026-07-07 13:42 ` Leon Hwang
2026-07-07 16:31 ` Eduard Zingerman
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=792983909e60289981e08026fe810e03a73f4f73.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=emil@etsalapatis.com \
--cc=jolsa@kernel.org \
--cc=kafai.wan@linux.dev \
--cc=leon.hwang@linux.dev \
--cc=loongarch@lists.linux.dev \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=puranjay@kernel.org \
--cc=song@kernel.org \
--cc=yangtiezhu@loongson.cn \
--cc=yonghong.song@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox