summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/init-common.c
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@csgroup.eu>2021-10-19 09:29:19 +0200
committerMichael Ellerman <mpe@ellerman.id.au>2021-12-09 22:41:18 +1100
commit6754862249d324b11f1361a5353e234325d805ec (patch)
tree73ceeae37bc71d002c4a597bcb2d99af4af5413a /arch/powerpc/mm/init-common.c
parent70428da94c7ad692d306747a04117543827292a7 (diff)
downloadlinux-6754862249d324b11f1361a5353e234325d805ec.tar.gz
linux-6754862249d324b11f1361a5353e234325d805ec.tar.bz2
linux-6754862249d324b11f1361a5353e234325d805ec.zip
powerpc/kuep: Remove 'nosmep' boot time parameter except for book3s/64
Deactivating KUEP at boot time is unrelevant for PPC32 and BOOK3E/64. Remove it. It allows to refactor setup_kuep() via a __weak function that only PPC64s will overide for now. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> [mpe: Fix CONFIG_PPC_BOOKS_64 -> CONFIG_PPC_BOOK3S_64 typo] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/4c36df18b41c988c4512f45d96220486adbe4c99.1634627931.git.christophe.leroy@csgroup.eu
Diffstat (limited to 'arch/powerpc/mm/init-common.c')
-rw-r--r--arch/powerpc/mm/init-common.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/powerpc/mm/init-common.c b/arch/powerpc/mm/init-common.c
index b4f3437aee38..119ef491f797 100644
--- a/arch/powerpc/mm/init-common.c
+++ b/arch/powerpc/mm/init-common.c
@@ -20,6 +20,7 @@
#include <linux/pgtable.h>
#include <asm/pgalloc.h>
#include <asm/kup.h>
+#include <asm/smp.h>
phys_addr_t memstart_addr __ro_after_init = (phys_addr_t)~0ull;
EXPORT_SYMBOL_GPL(memstart_addr);
@@ -33,6 +34,9 @@ bool disable_kuap = !IS_ENABLED(CONFIG_PPC_KUAP);
static int __init parse_nosmep(char *p)
{
+ if (!IS_ENABLED(CONFIG_PPC_BOOK3S_64))
+ return 0;
+
disable_kuep = true;
pr_warn("Disabling Kernel Userspace Execution Prevention\n");
return 0;
@@ -47,6 +51,17 @@ static int __init parse_nosmap(char *p)
}
early_param("nosmap", parse_nosmap);
+void __weak setup_kuep(bool disabled)
+{
+ if (!IS_ENABLED(CONFIG_PPC_KUEP) || disabled)
+ return;
+
+ if (smp_processor_id() != boot_cpuid)
+ return;
+
+ pr_info("Activating Kernel Userspace Execution Prevention\n");
+}
+
void setup_kup(void)
{
setup_kuap(disable_kuap);