summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/kprobe_multi_override.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2023-09-07 22:06:52 +0200
committerAndrii Nakryiko <andrii@kernel.org>2023-09-09 01:53:10 +0200
commit7182e56411b9a8b76797ed7b6095fc84be76dfb0 (patch)
tree234f2eef597e9207a3d90bb6fa6dfb9ad10062ba /tools/testing/selftests/bpf/progs/kprobe_multi_override.c
parentbpf: Add override check to kprobe multi link attach (diff)
downloadlinux-7182e56411b9a8b76797ed7b6095fc84be76dfb0.tar.xz
linux-7182e56411b9a8b76797ed7b6095fc84be76dfb0.zip
selftests/bpf: Add kprobe_multi override test
Adding test that tries to attach program with bpf_override_return helper to function not within error injection list. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20230907200652.926951-2-jolsa@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/progs/kprobe_multi_override.c')
-rw-r--r--tools/testing/selftests/bpf/progs/kprobe_multi_override.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/kprobe_multi_override.c b/tools/testing/selftests/bpf/progs/kprobe_multi_override.c
new file mode 100644
index 000000000000..28f8487c9059
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/kprobe_multi_override.c
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/bpf.h>
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
+
+char _license[] SEC("license") = "GPL";
+
+SEC("kprobe.multi")
+int test_override(struct pt_regs *ctx)
+{
+ bpf_override_return(ctx, 123);
+ return 0;
+}