Re: [PATCH v12] m68k, bpf: Add initial BPF JIT compiler support

From: bot+bpf-ci

Date: Thu Nov 26 2026 - 12:45:16 EST


> m68k, bpf: Add initial BPF JIT compiler support

TL;DR: Nits only, no bug found: the m68k JIT hardcodes the tail-call limit
(0x7021) and the 44/48-byte prologue jump offset; suggests named constants and
a check so later edits don't quietly break tail calls.

> diff --git a/arch/m68k/net/bpf_jit_comp.c b/arch/m68k/net/bpf_jit_comp.c
> new file mode 100644
> index 000000000000..96305a8478c7
> --- /dev/null
> +++ b/arch/m68k/net/bpf_jit_comp.c

[ ... ]

> + emit_16(ctx, (u16)STACK_OFFSET(BPF_TC_LO));
> +
> + emit_16(ctx, 0x2068); /* movea.l d16(%a0), %a0 */
> + emit_16(ctx, offsetof(struct bpf_prog, bpf_func));
> +
> + emit_16(ctx, 0x4ee8); /* jmp d16(%a0) */
> + emit_16(ctx, CPU_IS_COLDFIRE ? 48 : 44);
> +

[ ... ]

> +static void build_prologue(struct jit_ctx *ctx)
> +{
> + int total_stack = SCRATCH_SIZE + MAX_BPF_STACK + 8;
> +
> + emit_16(ctx, 0x7021); /* moveq #33, %d0 */
> +

this isn't a bug, but could the tail-call counter be emitted as
0x7000 | MAX_TAIL_CALL_CNT instead of the literal 0x7021, so that a grep
for MAX_TAIL_CALL_CNT finds this place if the limit ever changes?

Similarly, emit_tail_call() jumps to bpf_func + (CPU_IS_COLDFIRE ? 48 : 44),
which only holds while build_prologue() emits exactly 44 or 48 bytes. Could
that offset be a named constant that is checked against ctx->idx at the end
of build_prologue(), so a later edit to the prologue cannot quietly break
tail calls?


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/45866130532