powerpc/book3s64/hash/kuep: Enable KUEP on hash
authorAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Fri, 27 Nov 2020 04:44:22 +0000 (10:14 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 3 Dec 2020 14:01:27 +0000 (01:01 +1100)
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Reviewed-by: Sandipan Das <sandipan@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201127044424.40686-21-aneesh.kumar@linux.ibm.com
arch/powerpc/mm/book3s64/pkeys.c

index 9f01c86d2beb468945cc815da01f1fb7fc48f768..4a3aeddbe0c7e2fd207ec9189108834c1c5f8fef 100644 (file)
@@ -244,7 +244,12 @@ out:
 #ifdef CONFIG_PPC_KUEP
 void __init setup_kuep(bool disabled)
 {
-       if (disabled || !early_radix_enabled())
+       if (disabled)
+               return;
+       /*
+        * On hash if PKEY feature is not enabled, disable KUAP too.
+        */
+       if (!early_radix_enabled() && !early_mmu_has_feature(MMU_FTR_PKEY))
                return;
 
        if (smp_processor_id() == boot_cpuid) {