patch-testcases_kernel_syscalls_pkeys_pkey_h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --- ltp-full-20190930.orig/testcases/kernel/syscalls/pkeys/pkey.h 2019-09-30 13:30:26.000000000 +0200
  2. +++ ltp-full-20190930/testcases/kernel/syscalls/pkeys/pkey.h 2019-10-29 15:02:09.524423510 +0100
  3. @@ -1,6 +1,7 @@
  4. // SPDX-License-Identifier: GPL-2.0-or-later
  5. /*
  6. * Copyright (c) 2019 Red Hat, Inc.
  7. + * Copyright (c) Linux Test Project, 2019
  8. */
  9. #ifndef PKEYS_H
  10. @@ -15,25 +16,29 @@
  11. #endif
  12. #ifndef HAVE_PKEY_MPROTECT
  13. -static inline int pkey_mprotect(void *addr, size_t len, int prot, int pkey)
  14. +inline int ltp_pkey_mprotect(void *addr, size_t len, int prot, int pkey)
  15. {
  16. return tst_syscall(__NR_pkey_mprotect, addr, len, prot, pkey);
  17. }
  18. -static inline int pkey_alloc(unsigned int flags, unsigned int access_rights)
  19. +inline int ltp_pkey_alloc(unsigned int flags, unsigned int access_rights)
  20. {
  21. return tst_syscall(__NR_pkey_alloc, flags, access_rights);
  22. }
  23. -static inline int pkey_free(int pkey)
  24. +inline int ltp_pkey_free(int pkey)
  25. {
  26. return tst_syscall(__NR_pkey_free, pkey);
  27. }
  28. +#else
  29. +#define ltp_pkey_alloc pkey_alloc
  30. +#define ltp_pkey_free pkey_free
  31. +#define ltp_pkey_mprotect pkey_mprotect
  32. #endif /* HAVE_PKEY_MPROTECT */
  33. static inline void check_pkey_support(void)
  34. {
  35. - int pkey = pkey_alloc(0, 0);
  36. + int pkey = ltp_pkey_alloc(0, 0);
  37. if (pkey == -1) {
  38. if (errno == ENOSYS)
  39. @@ -44,7 +49,7 @@ static inline void check_pkey_support(vo
  40. tst_brk(TCONF, "pkeys are not available for test");
  41. }
  42. - pkey_free(pkey);
  43. + ltp_pkey_free(pkey);
  44. }
  45. #endif /* PKEYS_H */