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.
Reported-by: kernel test robot <redacted>
Fixes: 10248dcba120 ("powerpc/44x: Implement Kernel Userspace Exec Protection (KUEP)")
Fixes: 86f46f343272 ("powerpc/32s: Initialise KUAP and KUEP in C").
Signed-off-by: Christophe Leroy <redacted>
---
arch/powerpc/mm/nohash/44x.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2021-06-29 11:58:55
Christophe Leroy [off-list ref] writes:
quoted hunk
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.
Reported-by: kernel test robot <redacted>
Fixes: 10248dcba120 ("powerpc/44x: Implement Kernel Userspace Exec Protection (KUEP)")
Fixes: 86f46f343272 ("powerpc/32s: Initialise KUAP and KUEP in C").
Signed-off-by: Christophe Leroy <redacted>
---
arch/powerpc/mm/nohash/44x.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Building ppc44x_defconfig gives me:
/linux/arch/powerpc/mm/nohash/44x.c: In function 'setup_kuep':
/linux/arch/powerpc/mm/nohash/44x.c:246:35: error: 'boot_cpuid' undeclared (first use in this function); did you mean 'boot_cpu_init'?
246 | if (smp_processor_id() != boot_cpuid)
| ^~~~~~~~~~
| boot_cpu_init
/linux/arch/powerpc/mm/nohash/44x.c:246:35: note: each undeclared identifier is reported only once for each function it appears in
cheers
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.
Reported-by: kernel test robot <redacted>
Fixes: 10248dcba120 ("powerpc/44x: Implement Kernel Userspace Exec Protection (KUEP)")
Fixes: 86f46f343272 ("powerpc/32s: Initialise KUAP and KUEP in C").
Signed-off-by: Christophe Leroy <redacted>
---
arch/powerpc/mm/nohash/44x.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Building ppc44x_defconfig gives me:
/linux/arch/powerpc/mm/nohash/44x.c: In function 'setup_kuep':
/linux/arch/powerpc/mm/nohash/44x.c:246:35: error: 'boot_cpuid' undeclared (first use in this function); did you mean 'boot_cpu_init'?
246 | if (smp_processor_id() != boot_cpuid)
| ^~~~~~~~~~
| boot_cpu_init
/linux/arch/powerpc/mm/nohash/44x.c:246:35: note: each undeclared identifier is reported only once for each function it appears in
Seems like we need <asm/smp.h> when we don't have CONFIG_SMP.
I tested it with akebono_defconfig, looks like it has CONFIG_SMP.