diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/mm.h | 14 | ||||
| -rw-r--r-- | include/linux/pkeys.h | 13 |
2 files changed, 21 insertions, 6 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 611f19dd471d..0495e6f97fae 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -229,15 +229,21 @@ extern unsigned int kobjsize(const void *objp); | |||
| 229 | #define VM_HIGH_ARCH_4 BIT(VM_HIGH_ARCH_BIT_4) | 229 | #define VM_HIGH_ARCH_4 BIT(VM_HIGH_ARCH_BIT_4) |
| 230 | #endif /* CONFIG_ARCH_USES_HIGH_VMA_FLAGS */ | 230 | #endif /* CONFIG_ARCH_USES_HIGH_VMA_FLAGS */ |
| 231 | 231 | ||
| 232 | #if defined(CONFIG_X86) | 232 | #ifdef CONFIG_ARCH_HAS_PKEYS |
| 233 | # define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at once (x86) */ | ||
| 234 | #if defined (CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS) | ||
| 235 | # define VM_PKEY_SHIFT VM_HIGH_ARCH_BIT_0 | 233 | # define VM_PKEY_SHIFT VM_HIGH_ARCH_BIT_0 |
| 236 | # define VM_PKEY_BIT0 VM_HIGH_ARCH_0 /* A protection key is a 4-bit value */ | 234 | # define VM_PKEY_BIT0 VM_HIGH_ARCH_0 /* A protection key is a 4-bit value */ |
| 237 | # define VM_PKEY_BIT1 VM_HIGH_ARCH_1 | 235 | # define VM_PKEY_BIT1 VM_HIGH_ARCH_1 /* on x86 and 5-bit value on ppc64 */ |
| 238 | # define VM_PKEY_BIT2 VM_HIGH_ARCH_2 | 236 | # define VM_PKEY_BIT2 VM_HIGH_ARCH_2 |
| 239 | # define VM_PKEY_BIT3 VM_HIGH_ARCH_3 | 237 | # define VM_PKEY_BIT3 VM_HIGH_ARCH_3 |
| 238 | #ifdef CONFIG_PPC | ||
| 239 | # define VM_PKEY_BIT4 VM_HIGH_ARCH_4 | ||
| 240 | #else | ||
| 241 | # define VM_PKEY_BIT4 0 | ||
| 240 | #endif | 242 | #endif |
| 243 | #endif /* CONFIG_ARCH_HAS_PKEYS */ | ||
| 244 | |||
| 245 | #if defined(CONFIG_X86) | ||
| 246 | # define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at once (x86) */ | ||
| 241 | #elif defined(CONFIG_PPC) | 247 | #elif defined(CONFIG_PPC) |
| 242 | # define VM_SAO VM_ARCH_1 /* Strong Access Ordering (powerpc) */ | 248 | # define VM_SAO VM_ARCH_1 /* Strong Access Ordering (powerpc) */ |
| 243 | #elif defined(CONFIG_PARISC) | 249 | #elif defined(CONFIG_PARISC) |
diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h index 0794ca78c379..2955ba976048 100644 --- a/include/linux/pkeys.h +++ b/include/linux/pkeys.h | |||
| @@ -2,8 +2,7 @@ | |||
| 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_types.h> | 5 | #include <linux/mm.h> |
| 6 | #include <asm/mmu_context.h> | ||
| 7 | 6 | ||
| 8 | #ifdef CONFIG_ARCH_HAS_PKEYS | 7 | #ifdef CONFIG_ARCH_HAS_PKEYS |
| 9 | #include <asm/pkeys.h> | 8 | #include <asm/pkeys.h> |
| @@ -14,6 +13,11 @@ | |||
| 14 | #define PKEY_DEDICATED_EXECUTE_ONLY 0 | 13 | #define PKEY_DEDICATED_EXECUTE_ONLY 0 |
| 15 | #define ARCH_VM_PKEY_FLAGS 0 | 14 | #define ARCH_VM_PKEY_FLAGS 0 |
| 16 | 15 | ||
| 16 | static inline int vma_pkey(struct vm_area_struct *vma) | ||
| 17 | { | ||
| 18 | return 0; | ||
| 19 | } | ||
| 20 | |||
| 17 | static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey) | 21 | static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey) |
| 18 | { | 22 | { |
| 19 | return (pkey == 0); | 23 | return (pkey == 0); |
| @@ -35,6 +39,11 @@ static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, | |||
| 35 | return 0; | 39 | return 0; |
| 36 | } | 40 | } |
| 37 | 41 | ||
| 42 | static inline bool arch_pkeys_enabled(void) | ||
| 43 | { | ||
| 44 | return false; | ||
| 45 | } | ||
| 46 | |||
| 38 | static inline void copy_init_pkru_to_fpregs(void) | 47 | static inline void copy_init_pkru_to_fpregs(void) |
| 39 | { | 48 | { |
| 40 | } | 49 | } |
