summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorYonghong Song <yonghong.song@linux.dev>2026-10-16 11:31:20 -0700
committerAlexei Starovoitov <ast@kernel.org>2026-10-16 19:50:00 +0000
commit9b2e5136760a675202622459d242ac803f11d8d5 (patch)
tree8cdcaa9456dd0a8eb1cfa8d1a1f15350cfd1de8e /tools/perf/scripts/python
parent9c6fc12a8e4e249758d9ca6559123b24078af34e (diff)
bpf: Refuse a trampoline on an unreliable static function with stack args
When the BTF of a function in the target program is unreliable, the model of the function given to its trampoline is MAX_BPF_FUNC_REG_ARGS u64 arguments. The verifier takes a static function's stack arguments from its BTF before it finds the BTF unreliable, though, so such a function can still take more: one with six or more arguments, one of them a plain pointer, for example. The trampoline saves and restores five registers then. After an fentry program, the rest of the register arguments, r9 on x86-64 and x5 to x7 on arm64, hold whatever __bpf_prog_exit() left there, and for fexit the stack arguments are not copied either, so the function goes on with garbage in arguments the verifier checked, pointers included. Refuse the attach when such a function has more argument slots in its BTF than fit in registers. The main program is left alone: it takes only its context, and the verifier gives it no stack arguments when its BTF is unreliable. Fixes: 0f6bd5e7a804 ("bpf: Support stack arguments for bpf functions") Signed-off-by: Yonghong Song <yonghong.song@linux.dev> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261016183120.1136008-1-yonghong.song@linux.dev
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions