Lines Matching defs:pkey
33 static inline u64 pkey_to_vmflag_bits(u16 pkey)
35 return (((u64)pkey << VM_PKEY_SHIFT) & ARCH_VM_PKEY_FLAGS);
50 #define pkey_alloc_mask(pkey) (0x1 << pkey)
54 #define __mm_pkey_allocated(mm, pkey) { \
55 mm_pkey_allocation_map(mm) |= pkey_alloc_mask(pkey); \
58 #define __mm_pkey_free(mm, pkey) { \
59 mm_pkey_allocation_map(mm) &= ~pkey_alloc_mask(pkey); \
62 #define __mm_pkey_is_allocated(mm, pkey) \
63 (mm_pkey_allocation_map(mm) & pkey_alloc_mask(pkey))
65 #define __mm_pkey_is_reserved(pkey) (reserved_allocation_mask & \
66 pkey_alloc_mask(pkey))
68 static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey)
70 if (pkey < 0 || pkey >= arch_max_pkey())
74 if (__mm_pkey_is_reserved(pkey))
77 return __mm_pkey_is_allocated(mm, pkey);
88 * Note: this is the one and only place we make sure that the pkey is
110 static inline int mm_pkey_free(struct mm_struct *mm, int pkey)
115 if (!mm_pkey_is_allocated(mm, pkey))
118 __mm_pkey_free(mm, pkey);
129 int prot, int pkey);
131 int prot, int pkey)
140 if (pkey != -1)
141 return pkey;
143 return __arch_override_mprotect_pkey(vma, prot, pkey);
146 extern int __arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
148 static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
155 * userspace should not change pkey-0 permissions.
156 * pkey-0 is associated with every page in the kernel.
157 * If userspace denies any permission on pkey-0, the
160 if (pkey == 0)
163 return __arch_set_user_pkey_access(tsk, pkey, init_val);