diff options
author | Jiri Olsa <jolsa@kernel.org> | 2024-06-12 08:44:28 +0900 |
---|---|---|
committer | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2024-06-12 08:44:28 +0900 |
commit | 9e7f74e64ae58688a33a6445e4f9a4e291d0824f (patch) | |
tree | 2f3da3b7727acdc41be9632f2513ac27af1ed877 /tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c | |
parent | f42a58ffb8bb54e66bf9668a6be91477828c0c1b (diff) | |
download | linux-9e7f74e64ae58688a33a6445e4f9a4e291d0824f.tar.gz linux-9e7f74e64ae58688a33a6445e4f9a4e291d0824f.tar.bz2 linux-9e7f74e64ae58688a33a6445e4f9a4e291d0824f.zip |
selftests/bpf: Add uretprobe syscall call from user space test
Adding test to verify that when called from outside of the
trampoline provided by kernel, the uretprobe syscall will cause
calling process to receive SIGILL signal and the attached bpf
program is not executed.
Link: https://lore.kernel.org/all/20240611112158.40795-8-jolsa@kernel.org/
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c')
-rw-r--r-- | tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c b/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c new file mode 100644 index 000000000000..0d7f1a7db2e2 --- /dev/null +++ b/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "vmlinux.h" +#include <bpf/bpf_helpers.h> +#include <string.h> + +struct pt_regs regs; + +char _license[] SEC("license") = "GPL"; + +int executed = 0; + +SEC("uretprobe.multi") +int test(struct pt_regs *regs) +{ + executed = 1; + return 0; +} |