Skip to content

Commit a7aaa2f

Browse files
sandip4nmpe
authored andcommitted
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 743f354 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: 743f354 ("selftests/powerpc: Add wrapper for gettid") Reported-by: Sachin Sant <[email protected]> Suggested-by: David Laight <[email protected]> Suggested-by: Michael Ellerman <[email protected]> Signed-off-by: Sandipan Das <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/a4956d838bf59b0a71a2553c5ca81131ea8b49b9.1596561758.git.sandipan@linux.ibm.com
1 parent 0c83b27 commit a7aaa2f

File tree

1 file changed

+6
-6
lines changed
  • tools/testing/selftests/powerpc/include

1 file changed

+6
-6
lines changed

tools/testing/selftests/powerpc/include/pkeys.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131

3232
#define SI_PKEY_OFFSET 0x20
3333

34-
#define SYS_pkey_mprotect 386
35-
#define SYS_pkey_alloc 384
36-
#define SYS_pkey_free 385
34+
#define __NR_pkey_mprotect 386
35+
#define __NR_pkey_alloc 384
36+
#define __NR_pkey_free 385
3737

3838
#define PKEY_BITS_PER_PKEY 2
3939
#define NR_PKEYS 32
@@ -62,17 +62,17 @@ void pkey_set_rights(int pkey, unsigned long rights)
6262

6363
int sys_pkey_mprotect(void *addr, size_t len, int prot, int pkey)
6464
{
65-
return syscall(SYS_pkey_mprotect, addr, len, prot, pkey);
65+
return syscall(__NR_pkey_mprotect, addr, len, prot, pkey);
6666
}
6767

6868
int sys_pkey_alloc(unsigned long flags, unsigned long rights)
6969
{
70-
return syscall(SYS_pkey_alloc, flags, rights);
70+
return syscall(__NR_pkey_alloc, flags, rights);
7171
}
7272

7373
int sys_pkey_free(int pkey)
7474
{
75-
return syscall(SYS_pkey_free, pkey);
75+
return syscall(__NR_pkey_free, pkey);
7676
}
7777

7878
int pkeys_unsupported(void)

0 commit comments

Comments
 (0)