Dave Hansen | 66d3757 | 2016-02-12 13:02:32 -0800 | [diff] [blame] | 1 | #ifndef _LINUX_PKEYS_H |
| 2 | #define _LINUX_PKEYS_H |
| 3 | |
| 4 | #include <linux/mm_types.h> |
| 5 | #include <asm/mmu_context.h> |
| 6 | |
Dave Hansen | 66d3757 | 2016-02-12 13:02:32 -0800 | [diff] [blame] | 7 | #ifdef CONFIG_ARCH_HAS_PKEYS |
| 8 | #include <asm/pkeys.h> |
| 9 | #else /* ! CONFIG_ARCH_HAS_PKEYS */ |
| 10 | #define arch_max_pkey() (1) |
Dave Hansen | 62b5f7d | 2016-02-12 13:02:40 -0800 | [diff] [blame] | 11 | #define execute_only_pkey(mm) (0) |
| 12 | #define arch_override_mprotect_pkey(vma, prot, pkey) (0) |
| 13 | #define PKEY_DEDICATED_EXECUTE_ONLY 0 |
Dave Hansen | a8502b6 | 2016-07-29 09:30:13 -0700 | [diff] [blame] | 14 | #define ARCH_VM_PKEY_FLAGS 0 |
Dave Hansen | e8c24d3 | 2016-07-29 09:30:15 -0700 | [diff] [blame] | 15 | |
| 16 | static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey) |
| 17 | { |
| 18 | return (pkey == 0); |
| 19 | } |
| 20 | |
| 21 | static inline int mm_pkey_alloc(struct mm_struct *mm) |
| 22 | { |
| 23 | return -1; |
| 24 | } |
| 25 | |
| 26 | static inline int mm_pkey_free(struct mm_struct *mm, int pkey) |
| 27 | { |
Dave Hansen | e8c24d3 | 2016-07-29 09:30:15 -0700 | [diff] [blame] | 28 | return -EINVAL; |
| 29 | } |
| 30 | |
| 31 | static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, |
| 32 | unsigned long init_val) |
| 33 | { |
| 34 | return 0; |
| 35 | } |
| 36 | |
Dave Hansen | acd547b | 2016-07-29 09:30:21 -0700 | [diff] [blame] | 37 | static inline void copy_init_pkru_to_fpregs(void) |
| 38 | { |
| 39 | } |
| 40 | |
Dave Hansen | 66d3757 | 2016-02-12 13:02:32 -0800 | [diff] [blame] | 41 | #endif /* ! CONFIG_ARCH_HAS_PKEYS */ |
| 42 | |
Dave Hansen | 66d3757 | 2016-02-12 13:02:32 -0800 | [diff] [blame] | 43 | #endif /* _LINUX_PKEYS_H */ |