mm/core, x86/mm/pkeys: Add execute-only protection keys support
[deliverable/linux.git] / arch / x86 / include / asm / pkeys.h
index 5061aec2ed5ebc8cd06603233ecfdb5ee2ef9e90..7b84565c916c7b0329ac92c79c789748ff9eeb28 100644 (file)
@@ -6,4 +6,29 @@
 extern int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
                unsigned long init_val);
 
+/*
+ * Try to dedicate one of the protection keys to be used as an
+ * execute-only protection key.
+ */
+#define PKEY_DEDICATED_EXECUTE_ONLY 15
+extern int __execute_only_pkey(struct mm_struct *mm);
+static inline int execute_only_pkey(struct mm_struct *mm)
+{
+       if (!boot_cpu_has(X86_FEATURE_OSPKE))
+               return 0;
+
+       return __execute_only_pkey(mm);
+}
+
+extern int __arch_override_mprotect_pkey(struct vm_area_struct *vma,
+               int prot, int pkey);
+static inline int arch_override_mprotect_pkey(struct vm_area_struct *vma,
+               int prot, int pkey)
+{
+       if (!boot_cpu_has(X86_FEATURE_OSPKE))
+               return 0;
+
+       return __arch_override_mprotect_pkey(vma, prot, pkey);
+}
+
 #endif /*_ASM_X86_PKEYS_H */
This page took 0.060914 seconds and 5 git commands to generate.