Skip to content

Commit 00894c3

Browse files
yury-khrustalevctmarinas
authored andcommitted
selftests/powerpc: Use PKEY_UNRESTRICTED macro
Replace literal 0 with macro PKEY_UNRESTRICTED where pkey_*() functions are used in mm selftests for memory protection keys for ppc target. Signed-off-by: Yury Khrustalev <yury.khrustalev@arm.com> Suggested-by: Kevin Brodsky <kevin.brodsky@arm.com> Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com> Link: https://lore.kernel.org/r/20250113170619.484698-4-yury.khrustalev@arm.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 3809cef commit 00894c3

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

tools/testing/selftests/powerpc/include/pkeys.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ int pkeys_unsupported(void)
9393
SKIP_IF(!hash_mmu);
9494

9595
/* Check if the system call is supported */
96-
pkey = sys_pkey_alloc(0, 0);
96+
pkey = sys_pkey_alloc(0, PKEY_UNRESTRICTED);
9797
SKIP_IF(pkey < 0);
9898
sys_pkey_free(pkey);
9999

tools/testing/selftests/powerpc/mm/pkey_exec_prot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static void segv_handler(int signum, siginfo_t *sinfo, void *ctx)
7272

7373
switch (fault_type) {
7474
case PKEY_DISABLE_ACCESS:
75-
pkey_set_rights(fault_pkey, 0);
75+
pkey_set_rights(fault_pkey, PKEY_UNRESTRICTED);
7676
break;
7777
case PKEY_DISABLE_EXECUTE:
7878
/*

tools/testing/selftests/powerpc/mm/pkey_siginfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static void segv_handler(int signum, siginfo_t *sinfo, void *ctx)
8383
mprotect(pgstart, pgsize, PROT_EXEC))
8484
_exit(1);
8585
else
86-
pkey_set_rights(pkey, 0);
86+
pkey_set_rights(pkey, PKEY_UNRESTRICTED);
8787

8888
fault_count++;
8989
}

tools/testing/selftests/powerpc/ptrace/core-pkey.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,16 @@ static int child(struct shared_info *info)
9595
/* Get some pkeys so that we can change their bits in the AMR. */
9696
pkey1 = sys_pkey_alloc(0, PKEY_DISABLE_EXECUTE);
9797
if (pkey1 < 0) {
98-
pkey1 = sys_pkey_alloc(0, 0);
98+
pkey1 = sys_pkey_alloc(0, PKEY_UNRESTRICTED);
9999
FAIL_IF(pkey1 < 0);
100100

101101
disable_execute = false;
102102
}
103103

104-
pkey2 = sys_pkey_alloc(0, 0);
104+
pkey2 = sys_pkey_alloc(0, PKEY_UNRESTRICTED);
105105
FAIL_IF(pkey2 < 0);
106106

107-
pkey3 = sys_pkey_alloc(0, 0);
107+
pkey3 = sys_pkey_alloc(0, PKEY_UNRESTRICTED);
108108
FAIL_IF(pkey3 < 0);
109109

110110
info->amr |= 3ul << pkeyshift(pkey1) | 2ul << pkeyshift(pkey2);

tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,16 @@ static int child(struct shared_info *info)
5757
/* Get some pkeys so that we can change their bits in the AMR. */
5858
pkey1 = sys_pkey_alloc(0, PKEY_DISABLE_EXECUTE);
5959
if (pkey1 < 0) {
60-
pkey1 = sys_pkey_alloc(0, 0);
60+
pkey1 = sys_pkey_alloc(0, PKEY_UNRESTRICTED);
6161
CHILD_FAIL_IF(pkey1 < 0, &info->child_sync);
6262

6363
disable_execute = false;
6464
}
6565

66-
pkey2 = sys_pkey_alloc(0, 0);
66+
pkey2 = sys_pkey_alloc(0, PKEY_UNRESTRICTED);
6767
CHILD_FAIL_IF(pkey2 < 0, &info->child_sync);
6868

69-
pkey3 = sys_pkey_alloc(0, 0);
69+
pkey3 = sys_pkey_alloc(0, PKEY_UNRESTRICTED);
7070
CHILD_FAIL_IF(pkey3 < 0, &info->child_sync);
7171

7272
info->amr1 |= 3ul << pkeyshift(pkey1);

0 commit comments

Comments
 (0)