From fc4999864bca323f1b844fefe1b402632443c076 Mon Sep 17 00:00:00 2001 From: Christophe Leroy Date: Tue, 29 Jun 2021 12:24:21 +0000 Subject: powerpc/4xx: Fix setup_kuep() on SMP On SMP, setup_kuep() is also called from start_secondary() since commit 86f46f343272 ("powerpc/32s: Initialise KUAP and KUEP in C"). start_secondary() is not an __init function. Remove the __init marker from setup_kuep() and bail out when not caller on the first CPU as the work is already done. Fixes: 10248dcba120 ("powerpc/44x: Implement Kernel Userspace Exec Protection (KUEP)") Fixes: 86f46f343272 ("powerpc/32s: Initialise KUAP and KUEP in C") Reported-by: kernel test robot Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/8ee05934288994a65743a987acb1558f12c0c8c1.1624969450.git.christophe.leroy@csgroup.eu --- arch/powerpc/mm/nohash/44x.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'arch/powerpc') diff --git a/arch/powerpc/mm/nohash/44x.c b/arch/powerpc/mm/nohash/44x.c index 7da6d1e9fc9b..e079f26b267e 100644 --- a/arch/powerpc/mm/nohash/44x.c +++ b/arch/powerpc/mm/nohash/44x.c @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -241,8 +242,11 @@ void __init mmu_init_secondary(int cpu) #endif /* CONFIG_SMP */ #ifdef CONFIG_PPC_KUEP -void __init setup_kuep(bool disabled) +void setup_kuep(bool disabled) { + if (smp_processor_id() != boot_cpuid) + return; + if (disabled) patch_instruction_site(&patch__tlb_44x_kuep, ppc_inst(PPC_RAW_NOP())); else -- cgit v1.2.3