Commit | Line | Data |
---|---|---|
66d37570 DH |
1 | #ifndef _ASM_X86_PKEYS_H |
2 | #define _ASM_X86_PKEYS_H | |
3 | ||
4 | #define arch_max_pkey() (boot_cpu_has(X86_FEATURE_OSPKE) ? 16 : 1) | |
5 | ||
84594296 DH |
6 | extern int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, |
7 | unsigned long init_val); | |
8 | ||
62b5f7d0 DH |
9 | /* |
10 | * Try to dedicate one of the protection keys to be used as an | |
11 | * execute-only protection key. | |
12 | */ | |
13 | #define PKEY_DEDICATED_EXECUTE_ONLY 15 | |
14 | extern int __execute_only_pkey(struct mm_struct *mm); | |
15 | static inline int execute_only_pkey(struct mm_struct *mm) | |
16 | { | |
17 | if (!boot_cpu_has(X86_FEATURE_OSPKE)) | |
18 | return 0; | |
19 | ||
20 | return __execute_only_pkey(mm); | |
21 | } | |
22 | ||
23 | extern int __arch_override_mprotect_pkey(struct vm_area_struct *vma, | |
24 | int prot, int pkey); | |
25 | static inline int arch_override_mprotect_pkey(struct vm_area_struct *vma, | |
26 | int prot, int pkey) | |
27 | { | |
28 | if (!boot_cpu_has(X86_FEATURE_OSPKE)) | |
29 | return 0; | |
30 | ||
31 | return __arch_override_mprotect_pkey(vma, prot, pkey); | |
32 | } | |
33 | ||
66d37570 | 34 | #endif /*_ASM_X86_PKEYS_H */ |