pkeys.h 1016 B

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