diff options
| author | Kumar Kartikeya Dwivedi <memxor@gmail.com> | 2026-09-30 08:35:19 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-10-11 13:35:34 +0000 |
| commit | b4a1ecae94ae803fcd75fb16a7653ff86b64ed8b (patch) | |
| tree | 68ace0766331ee26560de6b8596fb25a205b26da /tools/testing | |
| parent | 0184613039a9976f0e6c6ef8dfee28948f126b74 (diff) | |
| download | linux-next-b4a1ecae94ae803fcd75fb16a7653ff86b64ed8b.tar.gz linux-next-b4a1ecae94ae803fcd75fb16a7653ff86b64ed8b.zip | |
bpf, riscv: Fix stack-passed arguments for indirect trampolines
store_args() reads stack-passed arguments relative to FP assuming the
trampoline was entered through the fentry call from a traced function. In
that path, the trampoline pushes the parent frame before establishing its
final FP, so the incoming stack arguments start at FP + 16.
An indirect trampoline for a struct_ops callback is called through a
function pointer. Its prologue allocates only the trampoline frame and sets
FP to the incoming SP. The RISC-V ABI places the first stack argument at
that incoming SP, so the arguments start at FP, not FP + 16. Every
stack-passed argument of a callback with more than eight argument slots is
therefore read two slots late.
Pass the prologue-dependent offset to store_args(), using zero for a direct
struct_ops trampoline and 16 for the fentry path.
Fixes: 6801b0aef79d ("riscv, bpf: Add 12-argument support for RV64 bpf trampoline")
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Pu Lehui <pulehui@huawei.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20260930083522.1914145-2-pulehui@huaweicloud.com
Diffstat (limited to 'tools/testing')
0 files changed, 0 insertions, 0 deletions
