]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests/powerpc: Use PKEY_UNRESTRICTED macro
authorYury Khrustalev <yury.khrustalev@arm.com>
Mon, 13 Jan 2025 17:06:19 +0000 (17:06 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Mon, 17 Feb 2025 18:16:36 +0000 (18:16 +0000)
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>
tools/testing/selftests/powerpc/include/pkeys.h
tools/testing/selftests/powerpc/mm/pkey_exec_prot.c
tools/testing/selftests/powerpc/mm/pkey_siginfo.c
tools/testing/selftests/powerpc/ptrace/core-pkey.c
tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c

index 3a0129467de6497f2be5549872b2a26222210540..c6d4063dd4f6f1d1948c7725ca064cbdcf64dfc8 100644 (file)
@@ -93,7 +93,7 @@ int pkeys_unsupported(void)
        SKIP_IF(!hash_mmu);
 
        /* Check if the system call is supported */
-       pkey = sys_pkey_alloc(0, 0);
+       pkey = sys_pkey_alloc(0, PKEY_UNRESTRICTED);
        SKIP_IF(pkey < 0);
        sys_pkey_free(pkey);
 
index 0af4f02669a115f547d33b8ed8261201876dbc57..29b91b7456eb935c48e861df7f34bc4e030622df 100644 (file)
@@ -72,7 +72,7 @@ static void segv_handler(int signum, siginfo_t *sinfo, void *ctx)
 
                switch (fault_type) {
                case PKEY_DISABLE_ACCESS:
-                       pkey_set_rights(fault_pkey, 0);
+                       pkey_set_rights(fault_pkey, PKEY_UNRESTRICTED);
                        break;
                case PKEY_DISABLE_EXECUTE:
                        /*
index 2db76e56d4cb99ee9897817fb3557a2f3e8800fc..e89a164c686ba14e4e674537b1ab10157388983d 100644 (file)
@@ -83,7 +83,7 @@ static void segv_handler(int signum, siginfo_t *sinfo, void *ctx)
            mprotect(pgstart, pgsize, PROT_EXEC))
                _exit(1);
        else
-               pkey_set_rights(pkey, 0);
+               pkey_set_rights(pkey, PKEY_UNRESTRICTED);
 
        fault_count++;
 }
index f061434af452b4fb57cf02953f613c44d2fa9d43..7ff53caeb4aa976ae41ee956e0a547b7a52d945e 100644 (file)
@@ -95,16 +95,16 @@ static int child(struct shared_info *info)
        /* Get some pkeys so that we can change their bits in the AMR. */
        pkey1 = sys_pkey_alloc(0, PKEY_DISABLE_EXECUTE);
        if (pkey1 < 0) {
-               pkey1 = sys_pkey_alloc(0, 0);
+               pkey1 = sys_pkey_alloc(0, PKEY_UNRESTRICTED);
                FAIL_IF(pkey1 < 0);
 
                disable_execute = false;
        }
 
-       pkey2 = sys_pkey_alloc(0, 0);
+       pkey2 = sys_pkey_alloc(0, PKEY_UNRESTRICTED);
        FAIL_IF(pkey2 < 0);
 
-       pkey3 = sys_pkey_alloc(0, 0);
+       pkey3 = sys_pkey_alloc(0, PKEY_UNRESTRICTED);
        FAIL_IF(pkey3 < 0);
 
        info->amr |= 3ul << pkeyshift(pkey1) | 2ul << pkeyshift(pkey2);
index fc633014424f767049f4d7b6c0b2c9dd8fac9ea5..10f63042cf91be686ba4d3ef8eb167e54fec7858 100644 (file)
@@ -57,16 +57,16 @@ static int child(struct shared_info *info)
        /* Get some pkeys so that we can change their bits in the AMR. */
        pkey1 = sys_pkey_alloc(0, PKEY_DISABLE_EXECUTE);
        if (pkey1 < 0) {
-               pkey1 = sys_pkey_alloc(0, 0);
+               pkey1 = sys_pkey_alloc(0, PKEY_UNRESTRICTED);
                CHILD_FAIL_IF(pkey1 < 0, &info->child_sync);
 
                disable_execute = false;
        }
 
-       pkey2 = sys_pkey_alloc(0, 0);
+       pkey2 = sys_pkey_alloc(0, PKEY_UNRESTRICTED);
        CHILD_FAIL_IF(pkey2 < 0, &info->child_sync);
 
-       pkey3 = sys_pkey_alloc(0, 0);
+       pkey3 = sys_pkey_alloc(0, PKEY_UNRESTRICTED);
        CHILD_FAIL_IF(pkey3 < 0, &info->child_sync);
 
        info->amr1 |= 3ul << pkeyshift(pkey1);