Re: [PATCH v2 2/3] LoongArch: BPF: Inline bpf_get_current_task{_btf}() helpers

From: bot+bpf-ci

Date: Wed Jun 10 2026 - 22:37:10 EST


> The pointer to task_struct is always available in the $tp register,
> the calls to bpf_get_current_task() and bpf_get_current_task_btf()
> can be inlined into a single move instruction.
>
> [ ... ]
>
> This is similar with commit 2bb138cb20a6 ("bpf, arm64: Inline
> bpf_get_current_task/_btf() helpers").
>
> Additionally, a safety check for bpf_jit_enable is introduced in
> bpf_jit_inlines_helper_call(). If CONFIG_BPF_JIT_ALWAYS_ON is not
> set and JIT is disabled at runtime, the function returns false to
> safely accommodate the fallback path to the BPF interpreter.
>
> Without this check, bpf_jit_inlines_helper_call() unconditionally
> returns true. As a result, the verifier would skip fixing up the
> call offset, leaving insn->imm as the raw helper ID rather than
> the expected "insn->imm = fn->func - __bpf_call_base".
>
> When the fallback interpreter executes (__bpf_call_base + insn->imm)
> with this raw ID, it jumps into an unaligned invalid address space,
> triggering a fatal instruction alignment fault (ADEF) kernel panic.
>
> [ ... ]
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>

The commit message describes a kernel panic on the interpreter fallback
path, where bpf_jit_inlines_helper_call() returning true caused the
verifier to skip rewriting insn->imm to (fn->func - __bpf_call_base),
so the interpreter ran (__bpf_call_base + raw_helper_id) and jumped to
an invalid address.

The bpf_jit_inlines_helper_call() contract, and the verifier logic that
skips the call-offset fixup when it returns true, were introduced
together with the unconditional return-true pattern that is now being
guarded with the !bpf_jit_enable check.

Should this carry a Fixes: tag pointing at that commit, for example:

Fixes: 2ddec2c80b44 ("riscv, bpf: inline bpf_get_smp_processor_id()")


---
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/27319300857