Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_PKEYS_H
0003 #define _LINUX_PKEYS_H
0004 
0005 #include <linux/mm.h>
0006 
0007 #define ARCH_DEFAULT_PKEY   0
0008 
0009 #ifdef CONFIG_ARCH_HAS_PKEYS
0010 #include <asm/pkeys.h>
0011 #else /* ! CONFIG_ARCH_HAS_PKEYS */
0012 #define arch_max_pkey() (1)
0013 #define execute_only_pkey(mm) (0)
0014 #define arch_override_mprotect_pkey(vma, prot, pkey) (0)
0015 #define PKEY_DEDICATED_EXECUTE_ONLY 0
0016 #define ARCH_VM_PKEY_FLAGS 0
0017 
0018 static inline int vma_pkey(struct vm_area_struct *vma)
0019 {
0020     return 0;
0021 }
0022 
0023 static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey)
0024 {
0025     return (pkey == 0);
0026 }
0027 
0028 static inline int mm_pkey_alloc(struct mm_struct *mm)
0029 {
0030     return -1;
0031 }
0032 
0033 static inline int mm_pkey_free(struct mm_struct *mm, int pkey)
0034 {
0035     return -EINVAL;
0036 }
0037 
0038 static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
0039             unsigned long init_val)
0040 {
0041     return 0;
0042 }
0043 
0044 static inline bool arch_pkeys_enabled(void)
0045 {
0046     return false;
0047 }
0048 
0049 #endif /* ! CONFIG_ARCH_HAS_PKEYS */
0050 
0051 #endif /* _LINUX_PKEYS_H */