From 5db26e8903deb111b303bd6e0cf304215e0b4fd9 Mon Sep 17 00:00:00 2001 From: Ram Pai Date: Tue, 17 Jul 2018 06:51:09 -0700 Subject: [PATCH] selftests/powerpc: Fix core-pkey for default execute permission change Only when the key is allocated, its permission are enabled. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Ram Pai Signed-off-by: Michael Ellerman --- tools/testing/selftests/powerpc/ptrace/core-pkey.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/powerpc/ptrace/core-pkey.c b/tools/testing/selftests/powerpc/ptrace/core-pkey.c index 36bc312..e23e2e1 100644 --- a/tools/testing/selftests/powerpc/ptrace/core-pkey.c +++ b/tools/testing/selftests/powerpc/ptrace/core-pkey.c @@ -140,6 +140,10 @@ static int child(struct shared_info *info) if (disable_execute) info->iamr |= 1ul << pkeyshift(pkey1); + else + info->iamr &= ~(1ul << pkeyshift(pkey1)); + + info->iamr &= ~(1ul << pkeyshift(pkey2) | 1ul << pkeyshift(pkey3)); info->uamor |= 3ul << pkeyshift(pkey1) | 3ul << pkeyshift(pkey2); -- 2.7.4