pkeys.h 990 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _LINUX_PKEYS_H
  3. #define _LINUX_PKEYS_H
  4. #include <linux/mm.h>
  5. #define ARCH_DEFAULT_PKEY 0
  6. #ifdef CONFIG_ARCH_HAS_PKEYS
  7. #include <asm/pkeys.h>
  8. #else /* ! CONFIG_ARCH_HAS_PKEYS */
  9. #define arch_max_pkey() (1)
  10. #define execute_only_pkey(mm) (0)
  11. #define arch_override_mprotect_pkey(vma, prot, pkey) (0)
  12. #define PKEY_DEDICATED_EXECUTE_ONLY 0
  13. #define ARCH_VM_PKEY_FLAGS 0
  14. static inline int vma_pkey(struct vm_area_struct *vma)
  15. {
  16. return 0;
  17. }
  18. static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey)
  19. {
  20. return (pkey == 0);
  21. }
  22. static inline int mm_pkey_alloc(struct mm_struct *mm)
  23. {
  24. return -1;
  25. }
  26. static inline int mm_pkey_free(struct mm_struct *mm, int pkey)
  27. {
  28. return -EINVAL;
  29. }
  30. static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
  31. unsigned long init_val)
  32. {
  33. return 0;
  34. }
  35. static inline bool arch_pkeys_enabled(void)
  36. {
  37. return false;
  38. }
  39. #endif /* ! CONFIG_ARCH_HAS_PKEYS */
  40. #endif /* _LINUX_PKEYS_H */