diff options
| author | Daniel Borkmann <daniel@iogearbox.net> | 2026-10-28 21:23:45 +0100 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-10-30 21:21:46 +0000 |
| commit | 99681d9a384f864543ec53fdb9f25800c12cfec3 (patch) | |
| tree | a215de71afef64c95a38e5c034b96673579a0ba2 /scripts/basic | |
| parent | 31ac959c915cc7f379d84cf9dadf3664cbcace02 (diff) | |
| download | linux-99681d9a384f864543ec53fdb9f25800c12cfec3.tar.gz linux-99681d9a384f864543ec53fdb9f25800c12cfec3.zip | |
selftests/bpf: Test kprobe and fentry/fexit programs on one function
A kprobe next to a BPF trampoline makes the ftrace site of the function
call ftrace_regs_caller and from there the list of ftrace callbacks,
the path that crashed while ftrace_ops_list_func() started at an odd
address. No test covers a function traced by both. Thus, attach an
fentry program and a kprobe to bpf_fentry_test1(), then a second fentry
program, which modifies the trampoline of the shared site, then an fexit
program, after which ftrace_regs_caller enters the trampoline by a jmp,
then detach the kprobe, after which the site jumps to it directly. After
each step, check that every attached program ran once for the call and
saw its argument, and the fexit program its return value.
Without the previous fix the test crashes the kernel, but only where
ftrace_ops_list_func() is at an odd address (in my test with gcc +
CONFIG_CC_OPTIMIZE_FOR_SIZE=y). With the fix it passes:
# LDLIBS=-static PKG_CONFIG='pkg-config --static' ./vmtest.sh -- ./test_progs -t fentry_kprobe_shared
[...]
#147 fentry_kprobe_shared:OK
Summary: 1/0 PASSED, 0 SKIPPED, 0/0 FAILED
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://patch.msgid.link/20261028202345.1215859-2-daniel@iogearbox.net
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions
