1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _LINUX_PKEYS_H 2 #ifndef _LINUX_PKEYS_H 3 #define _LINUX_PKEYS_H 3 #define _LINUX_PKEYS_H 4 4 5 #include <linux/mm.h> 5 #include <linux/mm.h> 6 6 7 #define ARCH_DEFAULT_PKEY 0 << 8 << 9 #ifdef CONFIG_ARCH_HAS_PKEYS 7 #ifdef CONFIG_ARCH_HAS_PKEYS 10 #include <asm/pkeys.h> 8 #include <asm/pkeys.h> 11 #else /* ! CONFIG_ARCH_HAS_PKEYS */ 9 #else /* ! CONFIG_ARCH_HAS_PKEYS */ 12 #define arch_max_pkey() (1) 10 #define arch_max_pkey() (1) 13 #define execute_only_pkey(mm) (0) 11 #define execute_only_pkey(mm) (0) 14 #define arch_override_mprotect_pkey(vma, prot, 12 #define arch_override_mprotect_pkey(vma, prot, pkey) (0) 15 #define PKEY_DEDICATED_EXECUTE_ONLY 0 13 #define PKEY_DEDICATED_EXECUTE_ONLY 0 16 #define ARCH_VM_PKEY_FLAGS 0 14 #define ARCH_VM_PKEY_FLAGS 0 17 15 18 static inline int vma_pkey(struct vm_area_stru 16 static inline int vma_pkey(struct vm_area_struct *vma) 19 { 17 { 20 return 0; 18 return 0; 21 } 19 } 22 20 23 static inline bool mm_pkey_is_allocated(struct 21 static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey) 24 { 22 { 25 return (pkey == 0); 23 return (pkey == 0); 26 } 24 } 27 25 28 static inline int mm_pkey_alloc(struct mm_stru 26 static inline int mm_pkey_alloc(struct mm_struct *mm) 29 { 27 { 30 return -1; 28 return -1; 31 } 29 } 32 30 33 static inline int mm_pkey_free(struct mm_struc 31 static inline int mm_pkey_free(struct mm_struct *mm, int pkey) 34 { 32 { 35 return -EINVAL; 33 return -EINVAL; 36 } 34 } 37 35 38 static inline int arch_set_user_pkey_access(st 36 static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, 39 unsigned long init_val 37 unsigned long init_val) 40 { 38 { 41 return 0; 39 return 0; 42 } 40 } 43 41 44 static inline bool arch_pkeys_enabled(void) 42 static inline bool arch_pkeys_enabled(void) 45 { 43 { 46 return false; 44 return false; >> 45 } >> 46 >> 47 static inline void copy_init_pkru_to_fpregs(void) >> 48 { 47 } 49 } 48 50 49 #endif /* ! CONFIG_ARCH_HAS_PKEYS */ 51 #endif /* ! CONFIG_ARCH_HAS_PKEYS */ 50 52 51 #endif /* _LINUX_PKEYS_H */ 53 #endif /* _LINUX_PKEYS_H */ 52 54
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.