Re: [PATCH bpf-next v2 1/7] bpf, arm64: Fix stack-passed arguments for indirect trampolines
| Newsgroups | org.kernel.vger.bpf |
|---|---|
| Message-ID | <7eb669da98fa166c2e6ae76c1fe7c830168cb30c858d8c7aabe02ddab532f231@mail.kernel.org> |
> bpf, arm64: Fix stack-passed arguments for indirect trampolines
>
> save_args() reads stack-passed arguments relative to FP assuming the
> trampoline is entered through the fentry call from a traced function, in
> which case both the parent frame (FP/x9) and the traced function frame
> (FP/LR) are saved before FP is set, so the arguments start at FP + 32.
>
> An indirect trampoline for a struct_ops callback is entered through a
> function pointer (blr), so only the FP/LR frame is pushed and the
> arguments start at FP + 16, not FP + 32. Every stack-passed argument of
> a struct_ops callback with more than eight argument slots is read two
> slots off.
>
> This went unnoticed because no struct_ops member passed arguments on the
> stack until bpf_testmod_ops3::test_arena_stack, added by
> commit 2d4de9a493a0 ("selftests/bpf: Test stack-passed struct_ops arena arguments").
> That member covers this on arm64 once the JIT gains arena argument
> support later in this series. Pass is_struct_ops into save_args() and
> pick the offset accordingly, mirroring the x86 fix.
Which x86 fix does this mirror? The commit message would be clearer with
a reference to the specific commit. For example, if this mirrors commit
473e3150e30a ("bpf, x86: Fix stack-passed arguments for indirect
trampolines"), citing it would help reviewers understand the cross-arch
consistency.
---
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/31735324691