diff options
author | Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> | 2022-02-04 17:05:20 +0530 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2022-02-07 08:05:24 -0800 |
commit | e91d280c840f133560072f246321f9a4d1f4eb14 (patch) | |
tree | 3d96529782391b85b04a82fdc8a62e9aa015b49a /tools/testing/selftests/bpf/progs/fexit_sleep.c | |
parent | 046b841ea7c528931e7d2e74d5e668aa6c94c1fc (diff) | |
download | linux-stable-e91d280c840f133560072f246321f9a4d1f4eb14.tar.gz linux-stable-e91d280c840f133560072f246321f9a4d1f4eb14.tar.bz2 linux-stable-e91d280c840f133560072f246321f9a4d1f4eb14.zip |
selftests/bpf: Fix tests to use arch-dependent syscall entry points
Some of the tests are using x86_64 ABI-specific syscall entry points
(such as __x64_sys_nanosleep and __x64_sys_getpgid). Update them to use
architecture-dependent syscall entry names.
Also update fexit_sleep test to not use BPF_PROG() so that it is clear
that the syscall parameters aren't being accessed in the bpf prog.
Note that none of the bpf progs in these tests are actually accessing
any of the syscall parameters. The only exception is perfbuf_bench, which
passes on the bpf prog context into bpf_perf_event_output() as a pointer
to pt_regs, but that looks to be mostly ignored.
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/e35f7051f03e269b623a68b139d8ed131325f7b7.1643973917.git.naveen.n.rao@linux.vnet.ibm.com
Diffstat (limited to 'tools/testing/selftests/bpf/progs/fexit_sleep.c')
-rw-r--r-- | tools/testing/selftests/bpf/progs/fexit_sleep.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/testing/selftests/bpf/progs/fexit_sleep.c b/tools/testing/selftests/bpf/progs/fexit_sleep.c index bca92c9bd29a..106dc75efcc4 100644 --- a/tools/testing/selftests/bpf/progs/fexit_sleep.c +++ b/tools/testing/selftests/bpf/progs/fexit_sleep.c @@ -3,6 +3,7 @@ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> +#include "bpf_misc.h" char LICENSE[] SEC("license") = "GPL"; @@ -10,8 +11,8 @@ int pid = 0; int fentry_cnt = 0; int fexit_cnt = 0; -SEC("fentry/__x64_sys_nanosleep") -int BPF_PROG(nanosleep_fentry, const struct pt_regs *regs) +SEC("fentry/" SYS_PREFIX "sys_nanosleep") +int nanosleep_fentry(void *ctx) { if (bpf_get_current_pid_tgid() >> 32 != pid) return 0; @@ -20,8 +21,8 @@ int BPF_PROG(nanosleep_fentry, const struct pt_regs *regs) return 0; } -SEC("fexit/__x64_sys_nanosleep") -int BPF_PROG(nanosleep_fexit, const struct pt_regs *regs, int ret) +SEC("fexit/" SYS_PREFIX "sys_nanosleep") +int nanosleep_fexit(void *ctx) { if (bpf_get_current_pid_tgid() >> 32 != pid) return 0; |