Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] purgatory: Disabling GCC's stack protection
@ 2015-04-28 12:50 Kevin Hao
  2015-04-30  4:39 ` Simon Horman
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Hao @ 2015-04-28 12:50 UTC (permalink / raw)
  To: kexec

If the GCC's stack protection is enabled by default, the purgatory will
also be built with this option. But it makes no sense to enable this
for the purgatory code, and would cause error when we are trying to
relocate the purgatory codes because symbol like __stack_chk_fail is
unresolved. Instead of disabling this for some archs specifically,
disable it for all the archs.

Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
---
 purgatory/Makefile            | 3 ++-
 purgatory/arch/ppc64/Makefile | 2 +-
 purgatory/arch/s390/Makefile  | 1 -
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/purgatory/Makefile b/purgatory/Makefile
index 19457029e79f..a25b2626be4d 100644
--- a/purgatory/Makefile
+++ b/purgatory/Makefile
@@ -47,7 +47,8 @@ purgatory/sha256.o: $(srcdir)/util_lib/sha256.c
 $(PURGATORY): CC=$(TARGET_CC)
 $(PURGATORY): CFLAGS+=$(PURGATORY_EXTRA_CFLAGS) \
 		      $($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
-		      -Os -fno-builtin -ffreestanding
+		      -Os -fno-builtin -ffreestanding \
+		      -fno-stack-protector
 
 $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
 			-I$(srcdir)/purgatory/include \
diff --git a/purgatory/arch/ppc64/Makefile b/purgatory/arch/ppc64/Makefile
index 712e2b194bee..31076e91c281 100644
--- a/purgatory/arch/ppc64/Makefile
+++ b/purgatory/arch/ppc64/Makefile
@@ -9,7 +9,7 @@ ppc64_PURGATORY_SRCS += purgatory/arch/ppc64/console-ppc64.c
 ppc64_PURGATORY_SRCS += purgatory/arch/ppc64/crashdump_backup.c
 ppc64_PURGATORY_SRCS += purgatory/arch/ppc64/misc.S
 
-ppc64_PURGATORY_EXTRA_CFLAGS += -m64 -msoft-float -fno-stack-protector
+ppc64_PURGATORY_EXTRA_CFLAGS += -m64 -msoft-float
 ppc64_PURGATORY_EXTRA_ASFLAGS += -m64
 ifeq ($(SUBARCH),BE)
 	ppc64_PURGATORY_EXTRA_LDFLAGS += -melf64ppc
diff --git a/purgatory/arch/s390/Makefile b/purgatory/arch/s390/Makefile
index 09749bd51a7f..c94cc3cec9eb 100644
--- a/purgatory/arch/s390/Makefile
+++ b/purgatory/arch/s390/Makefile
@@ -2,7 +2,6 @@
 # Purgatory s390
 #
 
-s390_PURGATORY_EXTRA_CFLAGS += -fno-stack-protector
 s390_PURGATORY_SRCS += purgatory/arch/s390/console-s390.c
 s390_PURGATORY_SRCS += purgatory/arch/s390/setup-s390.S
 s390_PURGATORY_SRCS += purgatory/arch/s390/purgatory-s390.c
-- 
2.1.0


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] purgatory: Disabling GCC's stack protection
  2015-04-28 12:50 [PATCH] purgatory: Disabling GCC's stack protection Kevin Hao
@ 2015-04-30  4:39 ` Simon Horman
  2015-04-30  5:08   ` Simon Horman
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Horman @ 2015-04-30  4:39 UTC (permalink / raw)
  To: Kevin Hao; +Cc: kexec

Hi Kevin,

On Tue, Apr 28, 2015 at 08:50:19PM +0800, Kevin Hao wrote:
> If the GCC's stack protection is enabled by default, the purgatory will
> also be built with this option. But it makes no sense to enable this
> for the purgatory code, and would cause error when we are trying to
> relocate the purgatory codes because symbol like __stack_chk_fail is
> unresolved. Instead of disabling this for some archs specifically,
> disable it for all the archs.
> 
> Signed-off-by: Kevin Hao <kexin.hao@windriver.com>

This seems like a reasonable change to me, however, it does
not apply cleanly to the kexec tree on kernel.org which I maintain.

https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git

Could you rebase and repost?

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] purgatory: Disabling GCC's stack protection
  2015-04-30  4:39 ` Simon Horman
@ 2015-04-30  5:08   ` Simon Horman
  2015-04-30  5:21     ` Kevin Hao
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Horman @ 2015-04-30  5:08 UTC (permalink / raw)
  To: Kevin Hao; +Cc: kexec

On Thu, Apr 30, 2015 at 01:39:50PM +0900, Simon Horman wrote:
> Hi Kevin,
> 
> On Tue, Apr 28, 2015 at 08:50:19PM +0800, Kevin Hao wrote:
> > If the GCC's stack protection is enabled by default, the purgatory will
> > also be built with this option. But it makes no sense to enable this
> > for the purgatory code, and would cause error when we are trying to
> > relocate the purgatory codes because symbol like __stack_chk_fail is
> > unresolved. Instead of disabling this for some archs specifically,
> > disable it for all the archs.
> > 
> > Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
> 
> This seems like a reasonable change to me, however, it does
> not apply cleanly to the kexec tree on kernel.org which I maintain.
> 
> https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
> 
> Could you rebase and repost?

I have now realised that Mike Frysinger has posted a similar,
slightly more comprehensive, patch which I have now applied.

Could you see if it addresses the problem you are seeing?

It is the following commit in the above tree:

4a837c9a19f9 purgatory: force PIC/PIE/SSP off

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] purgatory: Disabling GCC's stack protection
  2015-04-30  5:08   ` Simon Horman
@ 2015-04-30  5:21     ` Kevin Hao
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Hao @ 2015-04-30  5:21 UTC (permalink / raw)
  To: Simon Horman; +Cc: kexec


[-- Attachment #1.1: Type: text/plain, Size: 1402 bytes --]

On Thu, Apr 30, 2015 at 02:08:09PM +0900, Simon Horman wrote:
> On Thu, Apr 30, 2015 at 01:39:50PM +0900, Simon Horman wrote:
> > Hi Kevin,
> > 
> > On Tue, Apr 28, 2015 at 08:50:19PM +0800, Kevin Hao wrote:
> > > If the GCC's stack protection is enabled by default, the purgatory will
> > > also be built with this option. But it makes no sense to enable this
> > > for the purgatory code, and would cause error when we are trying to
> > > relocate the purgatory codes because symbol like __stack_chk_fail is
> > > unresolved. Instead of disabling this for some archs specifically,
> > > disable it for all the archs.
> > > 
> > > Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
> > 
> > This seems like a reasonable change to me, however, it does
> > not apply cleanly to the kexec tree on kernel.org which I maintain.
> > 
> > https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
> > 
> > Could you rebase and repost?
> 
> I have now realised that Mike Frysinger has posted a similar,
> slightly more comprehensive, patch which I have now applied.
> 
> Could you see if it addresses the problem you are seeing?
> 
> It is the following commit in the above tree:
> 
> 4a837c9a19f9 purgatory: force PIC/PIE/SSP off

Yes, it should solve my problem too. I didn't realized there already have
a patch for this issue. Sorry for the noise.

Thanks,
Kevin

[-- Attachment #1.2: Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

end of thread, other threads:[~2015-04-30  5:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-28 12:50 [PATCH] purgatory: Disabling GCC's stack protection Kevin Hao
2015-04-30  4:39 ` Simon Horman
2015-04-30  5:08   ` Simon Horman
2015-04-30  5:21     ` Kevin Hao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox