summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm
diff options
context:
space:
mode:
authorRam Pai2018-01-19 02:50:33 +0100
committerMichael Ellerman2018-01-20 12:59:01 +0100
commit013a91b39c2d5158cdc5529803f245bbb0526c7c (patch)
treedd2f86dc2e39316ea4f1bb2e689ec41fbf695480 /arch/powerpc/mm
parentpowerpc: introduce execute-only pkey (diff)
downloadkernel-qcow2-linux-013a91b39c2d5158cdc5529803f245bbb0526c7c.tar.gz
kernel-qcow2-linux-013a91b39c2d5158cdc5529803f245bbb0526c7c.tar.xz
kernel-qcow2-linux-013a91b39c2d5158cdc5529803f245bbb0526c7c.zip
powerpc: ability to associate pkey to a vma
arch-independent code expects the arch to map a pkey into the vma's protection bit setting. The patch provides that ability. Signed-off-by: Ram Pai <linuxram@us.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r--arch/powerpc/mm/pkeys.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/powerpc/mm/pkeys.c b/arch/powerpc/mm/pkeys.c
index 6fece6e6fc97..a4aac75f1a93 100644
--- a/arch/powerpc/mm/pkeys.c
+++ b/arch/powerpc/mm/pkeys.c
@@ -35,6 +35,14 @@ int pkey_initialize(void)
(PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE));
/*
+ * pkey_to_vmflag_bits() assumes that the pkey bits are contiguous
+ * in the vmaflag. Make sure that is really the case.
+ */
+ BUILD_BUG_ON(__builtin_clzl(ARCH_VM_PKEY_FLAGS >> VM_PKEY_SHIFT) +
+ __builtin_popcountl(ARCH_VM_PKEY_FLAGS >> VM_PKEY_SHIFT)
+ != (sizeof(u64) * BITS_PER_BYTE));
+
+ /*
* Disable the pkey system till everything is in place. A subsequent
* patch will enable it.
*/