summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/pkeys.h
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2018-04-12 15:54:00 +0200
committerMichael Ellerman <mpe@ellerman.id.au>2018-05-09 03:51:00 +0200
commit555934a71bb479ce109722807b374f2d98aefe89 (patch)
treee0624d2e95c8814200fbfabbaecfc5181f65c5ea /arch/x86/include/asm/pkeys.h
parentmm/pkeys, powerpc, x86: Provide an empty vma_pkey() in linux/pkeys.h (diff)
downloadlinux-555934a71bb479ce109722807b374f2d98aefe89.tar.xz
linux-555934a71bb479ce109722807b374f2d98aefe89.zip
x86/pkeys: Move vma_pkey() into asm/pkeys.h
Move the last remaining pkey helper, vma_pkey() into asm/pkeys.h Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Reviewed-by: Dave Hansen <dave.hansen@intel.com>
Diffstat (limited to 'arch/x86/include/asm/pkeys.h')
-rw-r--r--arch/x86/include/asm/pkeys.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/include/asm/pkeys.h b/arch/x86/include/asm/pkeys.h
index a0ba1ffda0df..0e5f749158e4 100644
--- a/arch/x86/include/asm/pkeys.h
+++ b/arch/x86/include/asm/pkeys.h
@@ -106,4 +106,12 @@ extern int __arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
unsigned long init_val);
extern void copy_init_pkru_to_fpregs(void);
+static inline int vma_pkey(struct vm_area_struct *vma)
+{
+ unsigned long vma_pkey_mask = VM_PKEY_BIT0 | VM_PKEY_BIT1 |
+ VM_PKEY_BIT2 | VM_PKEY_BIT3;
+
+ return (vma->vm_flags & vma_pkey_mask) >> VM_PKEY_SHIFT;
+}
+
#endif /*_ASM_X86_PKEYS_H */