diff mbox series

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

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

Checks

Context Check Description
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 1 blamed authors not CCed: Kenta.Tada@sony.com; 10 maintainers not CCed: Kenta.Tada@sony.com linux-kselftest@vger.kernel.org kpsingh@kernel.org john.fastabend@gmail.com kafai@fb.com shuah@kernel.org songliubraving@fb.com ast@kernel.org yhs@fb.com netdev@vger.kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next success VM_Test
bpf/vmtest-bpf-next-PR success PR summary

Commit Message

Naveen N. Rao Feb. 4, 2022, 11:35 a.m. UTC
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(+)
diff mbox series

Patch

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