[PATCH bpf-next 1/3] selftests/bpf: Use correct pt_regs on architectures without syscall wrapper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
---
 tools/testing/selftests/bpf/progs/bpf_syscall_macro.c | 4 ++++
 1 file changed, 4 insertions(+)

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));
-- 
2.34.1




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux