Skip to contentSkip to conversation

seccomp selftest on s390

PATCH Kees Cook 1 participant 1 message Aug 20, 2015

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

Hi!

I don't have access to s390 running a modern kernel, so I've not been able to meaningfully run the seccomp selftest suite. In a quick review, I think the following is close to the missing pieces, but I can't verify it. :)

Can someone let me know if this works, or otherwise check that the tools/testing/selftests/seccomp suite passes on s390?

Thanks!

-Kees

seccomp_bpf.c renamed from seccomp_bpf.c.orig +5 -1
@@ -1210,6 +1211,10 @@
 # define ARCH_REGS	struct pt_regs
 # define SYSCALL_NUM	gpr[0]
 # define SYSCALL_RET	gpr[3]
+#elif defined(__s390__)
+# define ARCH_REGS	s390_regs
+# define SYSCALL_NUM	gprs[1]
+# define SYSCALL_RET	gprs[2]
 #else
 # error "Do not know how to find your architecture's registers and syscalls"
 #endif
@@ -1243,7 +1248,7 @@
 	ret = ptrace(PTRACE_GETREGSET, tracee, NT_PRSTATUS, &iov);
 	EXPECT_EQ(0, ret);
 
-#if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__) || defined(__powerpc__)
+#if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__) || defined(__powerpc__) || defined(__s390__)
 	{
 		regs.SYSCALL_NUM = syscall;
 	}
Signature · 2 lines
Kees Cook
Chrome OS Security