summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs
diff options
context:
space:
mode:
authorDmitrii Dolgov <9erthalion6@gmail.com>2024-01-03 22:05:47 +0300
committerAlexei Starovoitov <ast@kernel.org>2024-01-05 07:40:49 +0300
commite02feb3f1f47509ec1e07b604bfbeff8c3b4e639 (patch)
tree0597b83407e92f101be92851c0b2e0eb5181b045 /tools/testing/selftests/bpf/progs
parent715d82ba636cb3629a6e18a33bb9dbe53f9936ee (diff)
downloadlinux-e02feb3f1f47509ec1e07b604bfbeff8c3b4e639.tar.xz
selftests/bpf: Test re-attachment fix for bpf_tracing_prog_attach
Add a test case to verify the fix for "prog->aux->dst_trampoline and tgt_prog is NULL" branch in bpf_tracing_prog_attach. The sequence of events: 1. load rawtp program 2. load fentry program with rawtp as target_fd 3. create tracing link for fentry program with target_fd = 0 4. repeat 3 Acked-by: Jiri Olsa <olsajiri@gmail.com> Acked-by: Song Liu <song@kernel.org> Signed-off-by: Dmitrii Dolgov <9erthalion6@gmail.com> Link: https://lore.kernel.org/r/20240103190559.14750-5-9erthalion6@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs')
-rw-r--r--tools/testing/selftests/bpf/progs/fentry_recursive_target.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/fentry_recursive_target.c b/tools/testing/selftests/bpf/progs/fentry_recursive_target.c
index cb18a8bfffac..267c876d0aba 100644
--- a/tools/testing/selftests/bpf/progs/fentry_recursive_target.c
+++ b/tools/testing/selftests/bpf/progs/fentry_recursive_target.c
@@ -14,3 +14,12 @@ int BPF_PROG(test1, int a)
{
return 0;
}
+
+/* Dummy bpf prog for testing attach_btf presence when attaching an fentry
+ * program.
+ */
+SEC("raw_tp/sys_enter")
+int BPF_PROG(fentry_target, struct pt_regs *regs, long id)
+{
+ return 0;
+}