aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/pkeys.c
diff options
context:
space:
mode:
authorRam Pai <linuxram@us.ibm.com>2018-07-17 06:51:03 -0700
committerMichael Ellerman <mpe@ellerman.id.au>2018-07-24 21:33:41 +1000
commitde113256f8c1c24d8c79ae388bf2a5abd70f7577 (patch)
tree1ee5ff88eddd380bd15ceaa30f41b8843a889b5b /arch/powerpc/mm/pkeys.c
parentpowerpc/pkeys: Give all threads control of their key permissions (diff)
downloadlinux-dev-de113256f8c1c24d8c79ae388bf2a5abd70f7577.tar.xz
linux-dev-de113256f8c1c24d8c79ae388bf2a5abd70f7577.zip
powerpc/pkeys: Deny read/write/execute by default
Deny all permissions on all keys, with some exceptions. pkey-0 must allow all permissions, or else everything comes to a screaching halt. Execute-only key must allow execute permission. Fixes: cf43d3b26452 ("powerpc: Enable pkey subsystem") Cc: stable@vger.kernel.org # v4.16+ Signed-off-by: Ram Pai <linuxram@us.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/mm/pkeys.c')
-rw-r--r--arch/powerpc/mm/pkeys.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/arch/powerpc/mm/pkeys.c b/arch/powerpc/mm/pkeys.c
index 6b55373f8c43..98180f49ac5e 100644
--- a/arch/powerpc/mm/pkeys.c
+++ b/arch/powerpc/mm/pkeys.c
@@ -124,12 +124,10 @@ int pkey_initialize(void)
/* register mask is in BE format */
pkey_amr_mask = ~0x0ul;
- pkey_iamr_mask = ~0x0ul;
+ pkey_amr_mask &= ~(0x3ul << pkeyshift(0));
- for (i = 0; i < (pkeys_total - os_reserved); i++) {
- pkey_amr_mask &= ~(0x3ul << pkeyshift(i));
- pkey_iamr_mask &= ~(0x1ul << pkeyshift(i));
- }
+ pkey_iamr_mask = ~0x0ul;
+ pkey_iamr_mask &= ~(0x3ul << pkeyshift(0));
pkey_uamor_mask = ~0x0ul;
pkey_uamor_mask &= ~(0x3ul << pkeyshift(0));