Commit e10cc871 authored by Aneesh Kumar K.V's avatar Aneesh Kumar K.V Committed by Michael Ellerman

powerpc/book3s64/kuep: Add MMU_FTR_KUEP

This will be used to enable/disable Kernel Userspace Execution
Prevention (KUEP).
Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200709032946.881753-15-aneesh.kumar@linux.ibm.com
parent d3cd91fb
...@@ -28,6 +28,11 @@ ...@@ -28,6 +28,11 @@
* Individual features below. * Individual features below.
*/ */
/*
* Support for KUEP feature.
*/
#define MMU_FTR_KUEP ASM_CONST(0x00000400)
/* /*
* Support for memory protection keys. * Support for memory protection keys.
*/ */
...@@ -189,6 +194,10 @@ enum { ...@@ -189,6 +194,10 @@ enum {
#ifdef CONFIG_PPC_MEM_KEYS #ifdef CONFIG_PPC_MEM_KEYS
MMU_FTR_PKEY | MMU_FTR_PKEY |
#endif #endif
#ifdef CONFIG_PPC_KUEP
MMU_FTR_KUEP |
#endif /* CONFIG_PPC_KUAP */
0, 0,
}; };
......
...@@ -593,8 +593,10 @@ void setup_kuep(bool disabled) ...@@ -593,8 +593,10 @@ void setup_kuep(bool disabled)
if (disabled || !early_radix_enabled()) if (disabled || !early_radix_enabled())
return; return;
if (smp_processor_id() == boot_cpuid) if (smp_processor_id() == boot_cpuid) {
pr_info("Activating Kernel Userspace Execution Prevention\n"); pr_info("Activating Kernel Userspace Execution Prevention\n");
cur_cpu_spec->mmu_features |= MMU_FTR_KUEP;
}
/* /*
* Radix always uses key0 of the IAMR to determine if an access is * Radix always uses key0 of the IAMR to determine if an access is
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment