• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From ce845e0a25d77c8cf0fae539d4596b83e65e3e70 Mon Sep 17 00:00:00 2001
2From: Steve Muckle <smuckle@google.com>
3Date: Tue, 24 Oct 2017 14:41:07 -0700
4Subject: [PATCH] seccomp: detect compat mode in ARM64
5
6Compat mode on ARM64 reports syscall numbering differently.
7
8Test: run vts-kernel -m VtsKernelLinuxKselftestStaging
9Bug: 33027081
10Change-Id: Ifc02bb48573b4a40f1857b41a7735a6e3d7a06e8
11Signed-off-by: Steve Muckle <smuckle@google.com>
12---
13 tools/testing/selftests/seccomp/seccomp_bpf.c | 5 +++--
14 1 file changed, 3 insertions(+), 2 deletions(-)
15
16diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
17index 2c81f4b9965d..1975e7d42e37 100644
18--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
19+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
20@@ -2295,6 +2295,7 @@ TEST(syscall_restart)
21 	};
22 #if defined(__arm__)
23 	struct utsname utsbuf;
24+	int arm_version;
25 #endif
26
27 	ASSERT_EQ(0, pipe(pipefd));
28@@ -2404,12 +2405,12 @@ TEST(syscall_restart)
29 	ret = get_syscall(_metadata, child_pid);
30 #if defined(__arm__)
31 	/*
32-	 * FIXME:
33 	 * - native ARM registers do NOT expose true syscall.
34 	 * - compat ARM registers on ARM64 DO expose true syscall.
35 	 */
36 	ASSERT_EQ(0, uname(&utsbuf));
37-	if (strncmp(utsbuf.machine, "arm", 3) == 0) {
38+	if (sscanf(utsbuf.machine, "armv%d", &arm_version) == 1 &&
39+	    arm_version < 8) {
40 		EXPECT_EQ(__NR_nanosleep, ret);
41 	} else
42 #endif
43--
442.16.0.rc1.238.g530d649a79-goog
45
46