From: sashiko-bot@kernel.org
To: "Kuan-Wei Chiu" <visitorckw@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH v7] m68k, bpf: Add initial BPF JIT compiler support
Date: Mon, 05 Oct 2026 19:07:20 +0000 [thread overview]
Message-ID: <20261005190721.44DB81F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261005185251.2422114-1-visitorckw@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] bpf: m68k JIT triggers page fault by prematurely locking subprogram memory
--
commit fa231b58c29a2f776715a46043e7efdefca56e74
Author: Kuan-Wei Chiu <visitorckw@gmail.com>
Subject: m68k, bpf: Add initial BPF JIT compiler support
This commit introduces a BPF JIT compiler for the m68k architecture. It
generates m68k machine code targeting m68020+ processors and coldfire parts
with an mmu.
> diff --git a/arch/m68k/net/bpf_jit_comp.c b/arch/m68k/net/bpf_jit_comp.c
> new file mode 100644
> --- /dev/null
> +++ b/arch/m68k/net/bpf_jit_comp.c
[ ... ]
> +struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_prog *prog)
> +{
[ ... ]
> + if (bpf_jit_enable > 1)
> + bpf_jit_dump(prog->len, image_size, 2, ctx.target);
> +
> + if ((!prog->aux->func || extra_pass) && bpf_jit_binary_lock_ro(header))
> + goto out_free_hdr;
[Severity: High]
Could this condition trigger a kernel page fault when JIT compiling BPF
programs with subprograms?
When loading a BPF program with subprograms, the BPF core invokes the JIT
compiler twice. In the first pass, prog->aux->func is NULL, but prog->is_func
is set to 1. Because this checks !prog->aux->func instead of !prog->is_func,
it evaluates to true and calls bpf_jit_binary_lock_ro() during the first
pass.
When the second pass runs, the JIT attempts to write the finalized
instructions to the already locked, read-only memory buffer, which would
trigger a page fault.
Should this check use !prog->is_func instead?
> +
> + prog->bpf_func = (void *)ctx.target;
> + prog->jited = 1;
> + prog->jited_len = image_size;
> + goto out_off;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261005185251.2422114-1-visitorckw@gmail.com?part=1
next prev parent reply other threads:[~2026-10-05 19:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 18:52 [PATCH v7] m68k, bpf: Add initial BPF JIT compiler support Kuan-Wei Chiu
2026-10-05 19:07 ` sashiko-bot [this message]
2026-10-05 19:48 ` bot+bpf-ci
2026-10-06 13:53 ` Greg Ungerer
2026-10-09 16:32 ` Kuan-Wei Chiu
2026-10-11 14:21 ` Greg Ungerer
2026-10-10 15:16 ` Alexei Starovoitov
2026-10-10 17:26 ` Kuan-Wei Chiu
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=20261005190721.44DB81F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=visitorckw@gmail.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.