]>
Commit | Line | Data |
---|---|---|
321d628a FG |
1 | From 6be390fe5b1a7e9480e9cf0f85777a8eb205ad08 Mon Sep 17 00:00:00 2001 |
2 | From: Andy Lutomirski <luto@kernel.org> | |
3 | Date: Sat, 4 Nov 2017 04:19:48 -0700 | |
e4cdf2a5 | 4 | Subject: [PATCH 112/241] selftests/x86/protection_keys: Fix syscall NR |
321d628a FG |
5 | redefinition warnings |
6 | MIME-Version: 1.0 | |
7 | Content-Type: text/plain; charset=UTF-8 | |
8 | Content-Transfer-Encoding: 8bit | |
9 | ||
10 | CVE-2017-5754 | |
11 | ||
12 | On new enough glibc, the pkey syscalls numbers are available. Check | |
13 | first before defining them to avoid warnings like: | |
14 | ||
15 | protection_keys.c:198:0: warning: "SYS_pkey_alloc" redefined | |
16 | ||
17 | Signed-off-by: Andy Lutomirski <luto@kernel.org> | |
18 | Cc: Borislav Petkov <bpetkov@suse.de> | |
19 | Cc: Dave Hansen <dave.hansen@intel.com> | |
20 | Cc: Linus Torvalds <torvalds@linux-foundation.org> | |
21 | Cc: Peter Zijlstra <peterz@infradead.org> | |
22 | Cc: Thomas Gleixner <tglx@linutronix.de> | |
23 | Cc: stable@vger.kernel.org | |
24 | Link: http://lkml.kernel.org/r/1fbef53a9e6befb7165ff855fc1a7d4788a191d6.1509794321.git.luto@kernel.org | |
25 | Signed-off-by: Ingo Molnar <mingo@kernel.org> | |
26 | (cherry picked from commit 693cb5580fdb026922363aa103add64b3ecd572e) | |
27 | Signed-off-by: Andy Whitcroft <apw@canonical.com> | |
28 | Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com> | |
29 | (cherry picked from commit 64c8ec4beb84ca8b0ff3250a8b6044d06be6315b) | |
30 | Signed-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 | ||
35 | diff --git a/tools/testing/selftests/x86/protection_keys.c b/tools/testing/selftests/x86/protection_keys.c | |
36 | index 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 | -- | |
76 | 2.14.2 | |
77 |