diff mbox series

[1/2] powerpc/core-pkeys: execute-permission on keys are disabled by default

Message ID 1529979376-7292-3-git-send-email-linuxram@us.ibm.com (mailing list archive)
State Awaiting Upstream
Headers show
Series [1/2] powerpc/core-pkeys: execute-permission on keys are disabled by default | expand

Commit Message

Ram Pai June 26, 2018, 2:16 a.m. UTC
Only when the key is allocated, its permission are enabled.

Signed-off-by: Ram Pai <linuxram@us.ibm.com>
---
 tools/testing/selftests/powerpc/ptrace/core-pkey.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Comments

Thiago Jung Bauermann July 3, 2018, 3:30 a.m. UTC | #1
Ram Pai <linuxram@us.ibm.com> writes:

> Only when the key is allocated, its permission are enabled.
>
> Signed-off-by: Ram Pai <linuxram@us.ibm.com>
> ---
>  tools/testing/selftests/powerpc/ptrace/core-pkey.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/tools/testing/selftests/powerpc/ptrace/core-pkey.c b/tools/testing/selftests/powerpc/ptrace/core-pkey.c
> index 36bc312..b353d86 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);

Reviewed-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
diff mbox series

Patch

diff --git a/tools/testing/selftests/powerpc/ptrace/core-pkey.c b/tools/testing/selftests/powerpc/ptrace/core-pkey.c
index 36bc312..b353d86 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);