Skip to contentSkip to conversation

selftests/powerpc: Fix pkey syscall redefinitions

PATCH Superseded Sandipan Das 1 participant 1 message Aug 3, 2020

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/powerpc: Fix pkey syscall redefinitions

Some distros have the pkey syscall numbers defined under unistd.h. This conflicts with the definitions in the pkeys selftest header and causes build failures.

E.g. this works

  $ grep -nr "SYS_pkey" /usr/include/
  /usr/include/bits/syscall.h:1575:# define SYS_pkey_alloc __NR_pkey_alloc
  /usr/include/bits/syscall.h:1579:# define SYS_pkey_free __NR_pkey_free
  /usr/include/bits/syscall.h:1583:# define SYS_pkey_mprotect __NR_pkey_mprotect

While this does not

  $ grep -nr "SYS_pkey" /usr/include/
  /usr/include/bits/syscall.h:1575:# define SYS_pkey_alloc __NR_pkey_alloc
  /usr/include/bits/syscall.h:1579:# define SYS_pkey_free __NR_pkey_free
  /usr/include/bits/syscall.h:1583:# define SYS_pkey_mprotect __NR_pkey_mprotect
  /usr/include/asm-generic/unistd.h:728:__SYSCALL(__NR_pkey_mprotect, sys_pkey_mprotect)
  /usr/include/asm-generic/unistd.h:730:__SYSCALL(__NR_pkey_alloc,    sys_pkey_alloc)
  /usr/include/asm-generic/unistd.h:732:__SYSCALL(__NR_pkey_free,     sys_pkey_free)
---
 tools/testing/selftests/powerpc/include/pkeys.h | 5 +++++
 1 file changed, 5 insertions(+)
tools/testing/selftests/powerpc/include/pkeys.h +5 -0
index 6ba95039a034..26eef5c1f8ea 100644
@@ -31,8 +31,13 @@
 
 #define SI_PKEY_OFFSET	0x20
 
+#undef SYS_pkey_mprotect
 #define SYS_pkey_mprotect	386
+
+#undef SYS_pkey_alloc
 #define SYS_pkey_alloc		384
+
+#undef SYS_pkey_free
 #define SYS_pkey_free		385
 
 #define PKEY_BITS_PER_PKEY	2
Signature · 1 line
2.25.1