* [PATCH] powerpc/64: Fix booting large kernels with STRICT_KERNEL_RWX
@ 2019-03-27 3:35 Russell Currey
2019-04-21 14:18 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Russell Currey @ 2019-03-27 3:35 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Russell Currey
With STRICT_KERNEL_RWX enabled anything marked __init is placed at a 16M
boundary. This is necessary so that it can be repurposed later with
different permissions. However, in kernels with text larger than 16M,
this pushes early_setup past 32M, incapable of being reached by the
branch instruction.
Fix this by setting the CTR and branching there instead.
Fixes: 1e0fc9d1eb2b ("powerpc/Kconfig: Enable STRICT_KERNEL_RWX for some configs")
Signed-off-by: Russell Currey <ruscur@russell.cc>
---
arch/powerpc/kernel/head_64.S | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 3fad8d499767..c2b53febadd9 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -968,7 +968,9 @@ start_here_multiplatform:
/* Restore parameters passed from prom_init/kexec */
mr r3,r31
- bl early_setup /* also sets r13 and SPRG_PACA */
+ LOAD_REG_ADDR(r12, early_setup)
+ mtctr r12
+ bctrl /* also sets r13 and SPRG_PACA */
LOAD_REG_ADDR(r3, start_here_common)
ld r4,PACAKMSR(r13)
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: powerpc/64: Fix booting large kernels with STRICT_KERNEL_RWX
2019-03-27 3:35 [PATCH] powerpc/64: Fix booting large kernels with STRICT_KERNEL_RWX Russell Currey
@ 2019-04-21 14:18 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2019-04-21 14:18 UTC (permalink / raw)
To: Russell Currey, linuxppc-dev
On Wed, 2019-03-27 at 03:35:54 UTC, Russell Currey wrote:
> With STRICT_KERNEL_RWX enabled anything marked __init is placed at a 16M
> boundary. This is necessary so that it can be repurposed later with
> different permissions. However, in kernels with text larger than 16M,
> this pushes early_setup past 32M, incapable of being reached by the
> branch instruction.
>
> Fix this by setting the CTR and branching there instead.
>
> Fixes: 1e0fc9d1eb2b ("powerpc/Kconfig: Enable STRICT_KERNEL_RWX for some configs")
> Signed-off-by: Russell Currey <ruscur@russell.cc>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/56c46bba9bbfe229b4472a5be313c44c
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-04-21 14:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-27 3:35 [PATCH] powerpc/64: Fix booting large kernels with STRICT_KERNEL_RWX Russell Currey
2019-04-21 14:18 ` Michael Ellerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.