Message ID | 17d8062517c4cfc4ee224fb0d49a4b84200557ca.1643973917.git.naveen.n.rao@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | BPF |
Headers | show |
Series | selftests/bpf: Fix tests on non-x86 architectures | expand |
diff --git a/tools/testing/selftests/bpf/progs/bpf_syscall_macro.c b/tools/testing/selftests/bpf/progs/bpf_syscall_macro.c index c8e60220cda855..12ec4b71f14aeb 100644 --- a/tools/testing/selftests/bpf/progs/bpf_syscall_macro.c +++ b/tools/testing/selftests/bpf/progs/bpf_syscall_macro.c @@ -32,7 +32,11 @@ int BPF_KPROBE(handle_sys_prctl) if (pid != filter_pid) return 0; +#if SYSCALL_WRAPPER == 1 real_regs = (struct pt_regs *)PT_REGS_PARM1(ctx); +#else + real_regs = (struct pt_regs *)ctx; +#endif /* test for PT_REGS_PARM */ bpf_probe_read_kernel(&arg1, sizeof(arg1), &PT_REGS_PARM1_SYSCALL(real_regs));
On architectures that are not using a syscall wrapper, syscall parameters can be accessed directly from the bpf prog ctx. Fix bpf_syscall_macro prog accordingly. Fixes: 77fc0330dfe5ab ("selftests/bpf: Add a test to confirm PT_REGS_PARM4_SYSCALL") Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> --- tools/testing/selftests/bpf/progs/bpf_syscall_macro.c | 4 ++++ 1 file changed, 4 insertions(+)