Skip to content

Commit

Permalink
powerpc/pkeys: Deny read/write/execute by default
Browse files Browse the repository at this point in the history
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: cf43d3b ("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>
  • Loading branch information
Ram Pai authored and Michael Ellerman committed Jul 24, 2018
1 parent a57a04c commit de11325
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions arch/powerpc/mm/pkeys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit de11325

Please sign in to comment.