Skip to content

Commit fc49998

Browse files
chleroympe
authored andcommitted
powerpc/4xx: Fix setup_kuep() on SMP
On SMP, setup_kuep() is also called from start_secondary() since commit 86f46f3 ("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: 10248dc ("powerpc/44x: Implement Kernel Userspace Exec Protection (KUEP)") Fixes: 86f46f3 ("powerpc/32s: Initialise KUAP and KUEP in C") Reported-by: kernel test robot <[email protected]> Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/8ee05934288994a65743a987acb1558f12c0c8c1.1624969450.git.christophe.leroy@csgroup.eu
1 parent c89e632 commit fc49998

File tree

1 file changed

+5
-1
lines changed
  • arch/powerpc/mm/nohash

1 file changed

+5
-1
lines changed

arch/powerpc/mm/nohash/44x.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <asm/page.h>
2626
#include <asm/cacheflush.h>
2727
#include <asm/code-patching.h>
28+
#include <asm/smp.h>
2829

2930
#include <mm/mmu_decl.h>
3031

@@ -241,8 +242,11 @@ void __init mmu_init_secondary(int cpu)
241242
#endif /* CONFIG_SMP */
242243

243244
#ifdef CONFIG_PPC_KUEP
244-
void __init setup_kuep(bool disabled)
245+
void setup_kuep(bool disabled)
245246
{
247+
if (smp_processor_id() != boot_cpuid)
248+
return;
249+
246250
if (disabled)
247251
patch_instruction_site(&patch__tlb_44x_kuep, ppc_inst(PPC_RAW_NOP()));
248252
else

0 commit comments

Comments
 (0)