linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/32: Fix boot failure with CONFIG_STACKPROTECTOR
@ 2021-04-29 16:52 Christophe Leroy
  2021-04-29 17:49 ` Jonathan Neuschäfer
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe Leroy @ 2021-04-29 16:52 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	j.neuschaefer, jniethe5
  Cc: linux-kernel, linuxppc-dev

Commit 7c95d8893fb5 ("powerpc: Change calling convention for
create_branch() et. al.") complexified the frame of function
do_feature_fixups(), leading to GCC setting up a stack
guard when CONFIG_STACKPROTECTOR is selected.

The problem is that do_feature_fixups() is called very early
while 'current' in r2 is not set up yet and the code is still
not at the final address used at link time.

So, like other instrumentation, stack protection needs to be
deactivated for feature-fixups.c and code-patching.c

Reported-by: Jonathan Neuschaefer <j.neuschaefer@gmx.net>
Fixes: 7c95d8893fb5 ("powerpc: Change calling convention for create_branch() et. al.")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/lib/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index f2c690ee75d1..cc1a8a0f311e 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -5,6 +5,9 @@
 
 ccflags-$(CONFIG_PPC64)	:= $(NO_MINIMAL_TOC)
 
+CFLAGS_code-patching.o += -fno-stack-protector
+CFLAGS_feature-fixups.o += -fno-stack-protector
+
 CFLAGS_REMOVE_code-patching.o = $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_feature-fixups.o = $(CC_FLAGS_FTRACE)
 
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc/32: Fix boot failure with CONFIG_STACKPROTECTOR
  2021-04-29 16:52 [PATCH] powerpc/32: Fix boot failure with CONFIG_STACKPROTECTOR Christophe Leroy
@ 2021-04-29 17:49 ` Jonathan Neuschäfer
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Neuschäfer @ 2021-04-29 17:49 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	j.neuschaefer, jniethe5, linux-kernel, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1001 bytes --]

On Thu, Apr 29, 2021 at 04:52:09PM +0000, Christophe Leroy wrote:
> Commit 7c95d8893fb5 ("powerpc: Change calling convention for
> create_branch() et. al.") complexified the frame of function
> do_feature_fixups(), leading to GCC setting up a stack
> guard when CONFIG_STACKPROTECTOR is selected.
> 
> The problem is that do_feature_fixups() is called very early
> while 'current' in r2 is not set up yet and the code is still
> not at the final address used at link time.
> 
> So, like other instrumentation, stack protection needs to be
> deactivated for feature-fixups.c and code-patching.c
> 
> Reported-by: Jonathan Neuschaefer <j.neuschaefer@gmx.net>
> Fixes: 7c95d8893fb5 ("powerpc: Change calling convention for create_branch() et. al.")
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---

Thank you for looking into this issue. This patch does indeed fix my
issue.

Tested-by: Jonathan Neuschaefer <j.neuschaefer@gmx.net>


Thanks again,
Jonathan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-29 17:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 16:52 [PATCH] powerpc/32: Fix boot failure with CONFIG_STACKPROTECTOR Christophe Leroy
2021-04-29 17:49 ` Jonathan Neuschäfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).