]> git.proxmox.com Git - pve-kernel.git/blame - patches/kernel/0112-selftests-x86-protection_keys-Fix-syscall-NR-redefin.patch
KPTI: add follow-up fixes
[pve-kernel.git] / patches / kernel / 0112-selftests-x86-protection_keys-Fix-syscall-NR-redefin.patch
CommitLineData
321d628a
FG
1From 6be390fe5b1a7e9480e9cf0f85777a8eb205ad08 Mon Sep 17 00:00:00 2001
2From: Andy Lutomirski <luto@kernel.org>
3Date: Sat, 4 Nov 2017 04:19:48 -0700
e4cdf2a5 4Subject: [PATCH 112/241] selftests/x86/protection_keys: Fix syscall NR
321d628a
FG
5 redefinition warnings
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10CVE-2017-5754
11
12On new enough glibc, the pkey syscalls numbers are available. Check
13first before defining them to avoid warnings like:
14
15protection_keys.c:198:0: warning: "SYS_pkey_alloc" redefined
16
17Signed-off-by: Andy Lutomirski <luto@kernel.org>
18Cc: Borislav Petkov <bpetkov@suse.de>
19Cc: Dave Hansen <dave.hansen@intel.com>
20Cc: Linus Torvalds <torvalds@linux-foundation.org>
21Cc: Peter Zijlstra <peterz@infradead.org>
22Cc: Thomas Gleixner <tglx@linutronix.de>
23Cc: stable@vger.kernel.org
24Link: http://lkml.kernel.org/r/1fbef53a9e6befb7165ff855fc1a7d4788a191d6.1509794321.git.luto@kernel.org
25Signed-off-by: Ingo Molnar <mingo@kernel.org>
26(cherry picked from commit 693cb5580fdb026922363aa103add64b3ecd572e)
27Signed-off-by: Andy Whitcroft <apw@canonical.com>
28Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
29(cherry picked from commit 64c8ec4beb84ca8b0ff3250a8b6044d06be6315b)
30Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
31---
32 tools/testing/selftests/x86/protection_keys.c | 24 ++++++++++++++++++------
33 1 file changed, 18 insertions(+), 6 deletions(-)
34
35diff --git a/tools/testing/selftests/x86/protection_keys.c b/tools/testing/selftests/x86/protection_keys.c
36index 3237bc010e1c..3c54d5c40952 100644
37--- a/tools/testing/selftests/x86/protection_keys.c
38+++ b/tools/testing/selftests/x86/protection_keys.c
39@@ -188,17 +188,29 @@ void lots_o_noops_around_write(int *write_to_me)
40 #define u64 uint64_t
41
42 #ifdef __i386__
43-#define SYS_mprotect_key 380
44-#define SYS_pkey_alloc 381
45-#define SYS_pkey_free 382
46+
47+#ifndef SYS_mprotect_key
48+# define SYS_mprotect_key 380
49+#endif
50+#ifndef SYS_pkey_alloc
51+# define SYS_pkey_alloc 381
52+# define SYS_pkey_free 382
53+#endif
54 #define REG_IP_IDX REG_EIP
55 #define si_pkey_offset 0x14
56+
57 #else
58-#define SYS_mprotect_key 329
59-#define SYS_pkey_alloc 330
60-#define SYS_pkey_free 331
61+
62+#ifndef SYS_mprotect_key
63+# define SYS_mprotect_key 329
64+#endif
65+#ifndef SYS_pkey_alloc
66+# define SYS_pkey_alloc 330
67+# define SYS_pkey_free 331
68+#endif
69 #define REG_IP_IDX REG_RIP
70 #define si_pkey_offset 0x20
71+
72 #endif
73
74 void dump_mem(void *dumpme, int len_bytes)
75--
762.14.2
77