Commit a7aaa2f2 authored by Sandipan Das's avatar Sandipan Das Committed by Michael Ellerman

selftests/powerpc: Fix pkey syscall redefinitions

On distros using older glibc versions, the pkey tests encounter build
failures due to redefinition of the pkey syscall numbers.

For compatibility, commit 743f3544 added a wrapper for the
gettid() syscall and included syscall.h if the version of glibc used
is older than 2.30. This leads to different definitions of SYS_pkey_*
as the ones in the pkey test header set numeric constants where as the
ones from syscall.h reuse __NR_pkey_*. The compiler complains about
redefinitions since they are different.

This replaces SYS_pkey_* definitions with __NR_pkey_* such that the
definitions in both syscall.h and pkeys.h are alike. This way, if
syscall.h has to be included for compatibility reasons, builds will
still succeed.

Fixes: 743f3544 ("selftests/powerpc: Add wrapper for gettid")
Reported-by: default avatarSachin Sant <sachinp@linux.vnet.ibm.com>
Suggested-by: default avatarDavid Laight <david.laight@aculab.com>
Suggested-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarSandipan Das <sandipan@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/a4956d838bf59b0a71a2553c5ca81131ea8b49b9.1596561758.git.sandipan@linux.ibm.com
parent 0c83b277
...@@ -31,9 +31,9 @@ ...@@ -31,9 +31,9 @@
#define SI_PKEY_OFFSET 0x20 #define SI_PKEY_OFFSET 0x20
#define SYS_pkey_mprotect 386 #define __NR_pkey_mprotect 386
#define SYS_pkey_alloc 384 #define __NR_pkey_alloc 384
#define SYS_pkey_free 385 #define __NR_pkey_free 385
#define PKEY_BITS_PER_PKEY 2 #define PKEY_BITS_PER_PKEY 2
#define NR_PKEYS 32 #define NR_PKEYS 32
...@@ -62,17 +62,17 @@ void pkey_set_rights(int pkey, unsigned long rights) ...@@ -62,17 +62,17 @@ void pkey_set_rights(int pkey, unsigned long rights)
int sys_pkey_mprotect(void *addr, size_t len, int prot, int pkey) int sys_pkey_mprotect(void *addr, size_t len, int prot, int pkey)
{ {
return syscall(SYS_pkey_mprotect, addr, len, prot, pkey); return syscall(__NR_pkey_mprotect, addr, len, prot, pkey);
} }
int sys_pkey_alloc(unsigned long flags, unsigned long rights) int sys_pkey_alloc(unsigned long flags, unsigned long rights)
{ {
return syscall(SYS_pkey_alloc, flags, rights); return syscall(__NR_pkey_alloc, flags, rights);
} }
int sys_pkey_free(int pkey) int sys_pkey_free(int pkey)
{ {
return syscall(SYS_pkey_free, pkey); return syscall(__NR_pkey_free, pkey);
} }
int pkeys_unsupported(void) int pkeys_unsupported(void)
......
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