Commit 693cb558 authored by Andy Lutomirski's avatar Andy Lutomirski Committed by Ingo Molnar

selftests/x86/protection_keys: Fix syscall NR redefinition warnings

On new enough glibc, the pkey syscalls numbers are available.  Check
first before defining them to avoid warnings like:

protection_keys.c:198:0: warning: "SYS_pkey_alloc" redefined
Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bpetkov@suse.de>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/1fbef53a9e6befb7165ff855fc1a7d4788a191d6.1509794321.git.luto@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent f3a624e9
...@@ -189,17 +189,29 @@ void lots_o_noops_around_write(int *write_to_me) ...@@ -189,17 +189,29 @@ void lots_o_noops_around_write(int *write_to_me)
#define u64 uint64_t #define u64 uint64_t
#ifdef __i386__ #ifdef __i386__
#define SYS_mprotect_key 380
#define SYS_pkey_alloc 381 #ifndef SYS_mprotect_key
#define SYS_pkey_free 382 # define SYS_mprotect_key 380
#endif
#ifndef SYS_pkey_alloc
# define SYS_pkey_alloc 381
# define SYS_pkey_free 382
#endif
#define REG_IP_IDX REG_EIP #define REG_IP_IDX REG_EIP
#define si_pkey_offset 0x14 #define si_pkey_offset 0x14
#else #else
#define SYS_mprotect_key 329
#define SYS_pkey_alloc 330 #ifndef SYS_mprotect_key
#define SYS_pkey_free 331 # define SYS_mprotect_key 329
#endif
#ifndef SYS_pkey_alloc
# define SYS_pkey_alloc 330
# define SYS_pkey_free 331
#endif
#define REG_IP_IDX REG_RIP #define REG_IP_IDX REG_RIP
#define si_pkey_offset 0x20 #define si_pkey_offset 0x20
#endif #endif
void dump_mem(void *dumpme, int len_bytes) void dump_mem(void *dumpme, int len_bytes)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment