blob: 8ff21125dc8a5594b52dbcc3bfa95e55a2f27e84 [file] [log] [blame]
Dave Hansen66d37572016-02-12 13:02:32 -08001#ifndef _LINUX_PKEYS_H
2#define _LINUX_PKEYS_H
3
4#include <linux/mm_types.h>
5#include <asm/mmu_context.h>
6
Dave Hansen66d37572016-02-12 13:02:32 -08007#ifdef CONFIG_ARCH_HAS_PKEYS
8#include <asm/pkeys.h>
9#else /* ! CONFIG_ARCH_HAS_PKEYS */
10#define arch_max_pkey() (1)
Dave Hansen62b5f7d2016-02-12 13:02:40 -080011#define execute_only_pkey(mm) (0)
12#define arch_override_mprotect_pkey(vma, prot, pkey) (0)
13#define PKEY_DEDICATED_EXECUTE_ONLY 0
Dave Hansena8502b62016-07-29 09:30:13 -070014#define ARCH_VM_PKEY_FLAGS 0
Dave Hansene8c24d32016-07-29 09:30:15 -070015
16static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey)
17{
18 return (pkey == 0);
19}
20
21static inline int mm_pkey_alloc(struct mm_struct *mm)
22{
23 return -1;
24}
25
26static inline int mm_pkey_free(struct mm_struct *mm, int pkey)
27{
28 WARN_ONCE(1, "free of protection key when disabled");
29 return -EINVAL;
30}
31
32static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
33 unsigned long init_val)
34{
35 return 0;
36}
37
Dave Hansen66d37572016-02-12 13:02:32 -080038#endif /* ! CONFIG_ARCH_HAS_PKEYS */
39
Dave Hansen66d37572016-02-12 13:02:32 -080040#endif /* _LINUX_PKEYS_H */