lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Thu, 3 Mar 2016 16:04:18 -0800
From:	Kees Cook <keescook@...omium.org>
To:	Markos Chandras <markos.chandras@...tec.com>
Cc:	James Hogan <james.hogan@...tec.com>,
	Milko Leporis <milko.leporis@...tec.com>,
	Ralf Baechle <ralf@...ux-mips.org>,
	Andy Lutomirski <luto@...capital.net>,
	Will Drewry <wad@...omium.org>,
	Shuah Khan <shuahkh@....samsung.com>,
	linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-mips@...ux-mips.org
Subject: [RFC][PATCH] selftests/seccomp: add MIPS self-test support

This adds self-test support on MIPS. (On at least Bionic, the siginfo
headers require pid_t and clock_t to be defined first, so this meant
moving the sys/types.h include to before siginfo.h.)

Signed-off-by: Kees Cook <keescook@...omium.org>
---
I don't have hardware at the moment to test this. Can someone check this?
It's based on my best guess about the syscall ABI (v0 for syscall and
return value, which is regs[2]).
---
 tools/testing/selftests/seccomp/seccomp_bpf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index b9453b838162..bf59558fd50d 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -5,6 +5,7 @@
  * Test code for seccomp bpf.
  */
 
+#include <sys/types.h>
 #include <asm/siginfo.h>
 #define __have_siginfo_t 1
 #define __have_sigval_t 1
@@ -14,7 +15,6 @@
 #include <linux/filter.h>
 #include <sys/prctl.h>
 #include <sys/ptrace.h>
-#include <sys/types.h>
 #include <sys/user.h>
 #include <linux/prctl.h>
 #include <linux/ptrace.h>
@@ -1242,6 +1242,10 @@ TEST_F(TRACE_poke, getpid_runs_normally)
 # define ARCH_REGS     s390_regs
 # define SYSCALL_NUM   gprs[2]
 # define SYSCALL_RET   gprs[2]
+#elif defined(__mips__)
+# define ARCH_REGS	struct pt_regs
+# define SYSCALL_NUM	regs[2]
+# define SYSCALL_RET	regs[2]
 #else
 # error "Do not know how to find your architecture's registers and syscalls"
 #endif
@@ -1293,7 +1297,7 @@ void change_syscall(struct __test_metadata *_metadata,
 	EXPECT_EQ(0, ret);
 
 #if defined(__x86_64__) || defined(__i386__) || defined(__powerpc__) || \
-    defined(__s390__)
+    defined(__s390__) || defined(__mips__)
 	{
 		regs.SYSCALL_NUM = syscall;
 	}
-- 
2.6.3


-- 
Kees Cook
Chrome OS & Brillo Security

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ