summaryrefslogtreecommitdiff
path: root/arch/powerpc/mm/book3s32
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@csgroup.eu>2021-06-03 11:41:42 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2021-06-16 17:09:08 +0300
commit50d2f104cd9572af476579eae9aa1b38de602ec7 (patch)
tree91fd88774d6ed6efb0cbbbc8fdbb24d8f357fe6f /arch/powerpc/mm/book3s32
parent86f46f3432727933be82f64b739712a6edb9d704 (diff)
downloadlinux-50d2f104cd9572af476579eae9aa1b38de602ec7.tar.xz
powerpc/32s: Allow disabling KUEP at boot time
PPC64 uses MMU features to enable/disable KUEP at boot time. But feature fixups are applied way too early on PPC32. Now that all KUEP related actions are in C following the conversion of KUEP initial setup and context switch in C, static branches can be used to enable/disable KUEP. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/7745a2c3a08ec46302920a3f48d1cb9b5469dbbb.1622708530.git.christophe.leroy@csgroup.eu
Diffstat (limited to 'arch/powerpc/mm/book3s32')
-rw-r--r--arch/powerpc/mm/book3s32/kuep.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/powerpc/mm/book3s32/kuep.c b/arch/powerpc/mm/book3s32/kuep.c
index 3147e2edcf63..3f6eb6e23fca 100644
--- a/arch/powerpc/mm/book3s32/kuep.c
+++ b/arch/powerpc/mm/book3s32/kuep.c
@@ -3,15 +3,18 @@
#include <asm/kup.h>
#include <asm/smp.h>
+struct static_key_false disable_kuep_key;
+
void __init setup_kuep(bool disabled)
{
- kuep_lock();
+ if (!disabled)
+ kuep_lock();
if (smp_processor_id() != boot_cpuid)
return;
- pr_info("Activating Kernel Userspace Execution Prevention\n");
-
if (disabled)
- pr_warn("KUEP cannot be disabled yet on 6xx when compiled in\n");
+ static_branch_enable(&disable_kuep_key);
+ else
+ pr_info("Activating Kernel Userspace Execution Prevention\n");
}