Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
66d37570 DH |
2 | #ifndef _LINUX_PKEYS_H |
3 | #define _LINUX_PKEYS_H | |
4 | ||
555934a7 | 5 | #include <linux/mm.h> |
66d37570 | 6 | |
d4ffd5df JL |
7 | #define ARCH_DEFAULT_PKEY 0 |
8 | ||
66d37570 DH |
9 | #ifdef CONFIG_ARCH_HAS_PKEYS |
10 | #include <asm/pkeys.h> | |
11 | #else /* ! CONFIG_ARCH_HAS_PKEYS */ | |
12 | #define arch_max_pkey() (1) | |
62b5f7d0 DH |
13 | #define execute_only_pkey(mm) (0) |
14 | #define arch_override_mprotect_pkey(vma, prot, pkey) (0) | |
15 | #define PKEY_DEDICATED_EXECUTE_ONLY 0 | |
a8502b67 | 16 | #define ARCH_VM_PKEY_FLAGS 0 |
e8c24d3a | 17 | |
dbec10e5 ME |
18 | static inline int vma_pkey(struct vm_area_struct *vma) |
19 | { | |
20 | return 0; | |
21 | } | |
22 | ||
e8c24d3a DH |
23 | static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey) |
24 | { | |
25 | return (pkey == 0); | |
26 | } | |
27 | ||
28 | static inline int mm_pkey_alloc(struct mm_struct *mm) | |
29 | { | |
30 | return -1; | |
31 | } | |
32 | ||
33 | static inline int mm_pkey_free(struct mm_struct *mm, int pkey) | |
34 | { | |
e8c24d3a DH |
35 | return -EINVAL; |
36 | } | |
37 | ||
38 | static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, | |
39 | unsigned long init_val) | |
40 | { | |
41 | return 0; | |
42 | } | |
43 | ||
4414ef95 ME |
44 | static inline bool arch_pkeys_enabled(void) |
45 | { | |
46 | return false; | |
47 | } | |
48 | ||
66d37570 DH |
49 | #endif /* ! CONFIG_ARCH_HAS_PKEYS */ |
50 | ||
66d37570 | 51 | #endif /* _LINUX_PKEYS_H */ |