summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorYonghong Song <yonghong.song@linux.dev>2026-10-16 11:31:15 -0700
committerAlexei Starovoitov <ast@kernel.org>2026-10-16 19:50:00 +0000
commit9c6fc12a8e4e249758d9ca6559123b24078af34e (patch)
tree6d75cc093a1b09d5f13fb146fbed858c386732d1 /tools/perf/scripts/python
parentb68782116bfdcdd05949a662c14d5fa644d10ab8 (diff)
selftests/bpf: Test trampoline args of a BPF function at an odd slot
Attach fentry and fexit programs to two functions of another BPF program, each taking a struct holding an __int128 at an odd argument slot: - callee_odd(): the struct after a single u64, where arm64 would leave a register empty. - callee_stack(): the struct after seven u64s, where x86-64 would leave a stack slot empty and arm64 a register. BPF code calls them with the arguments packed in the BPF convention, so that is where the trampoline has to take them from. The fentry programs take the arguments with BPF_PROG2(), which reads each from its slots in ctx[], and the fexit programs check the return value, weighted by slot, which is only right if the function got its arguments back where its caller put them. Both take a struct by value, which GCC passes by reference instead, so they are only built with clang, and callee_stack() only with a clang that supports stack arguments. Unlike a kernel function taking an __int128, which s390x passes by reference, nothing in the test depends on how the arch passes a 16-byte value, so it runs on s390x as well as on x86_64 and arm64. BPF_PROG2() reads the struct from its two context slots the way BPF code passed it, so its halves come out right on big-endian s390x too. The s390 JIT does not take stack arguments, so callee_stack() is only built for x86 and arm64, and only callee_odd() is traced on s390x. Describing the functions to the trampoline by the types of their arguments, rather than as one u64 per slot, the x86-64 trampoline fails the test with: test_int128_tgt_prog:FAIL:stack:h.lo unexpected stack:h.lo: actual 9 != expected 8 test_int128_tgt_prog:FAIL:stack:h.hi unexpected stack:h.hi: actual 10 != expected 9 Signed-off-by: Yonghong Song <yonghong.song@linux.dev> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261016183115.1135762-1-yonghong.song@linux.dev
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions