linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* x86/purgatory: undefined symbol __stack_chk_fail
@ 2019-09-03 15:50 Andreas Smas
  2019-09-28  0:48 ` Randy Dunlap
  2019-09-28 17:17 ` Rasmus Villemoes
  0 siblings, 2 replies; 6+ messages in thread
From: Andreas Smas @ 2019-09-03 15:50 UTC (permalink / raw)
  To: linux-kernel

Hi,

For me, kernels built including this commit
b059f801a937 (x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS)

results in kexec() failing to load the kernel:

kexec: Undefined symbol: __stack_chk_fail
kexec-bzImage64: Loading purgatory failed

Can be seen:

$ readelf -a arch/x86/purgatory/purgatory.ro | grep UND
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
    51: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __stack_chk_fail

Using: gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)

Adding -ffreestanding or -fno-stack-protector to ccflags-y in
arch/x86/purgatory/Makefile
fixes the problem. Not sure which would be preferred.

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

* Re: x86/purgatory: undefined symbol __stack_chk_fail
  2019-09-03 15:50 x86/purgatory: undefined symbol __stack_chk_fail Andreas Smas
@ 2019-09-28  0:48 ` Randy Dunlap
  2019-09-28 12:41   ` Ingo Molnar
  2019-09-28 17:17 ` Rasmus Villemoes
  1 sibling, 1 reply; 6+ messages in thread
From: Randy Dunlap @ 2019-09-28  0:48 UTC (permalink / raw)
  To: Andreas Smas, linux-kernel; +Cc: X86 ML

On 9/3/19 8:50 AM, Andreas Smas wrote:
> Hi,
> 
> For me, kernels built including this commit
> b059f801a937 (x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS)
> 
> results in kexec() failing to load the kernel:
> 
> kexec: Undefined symbol: __stack_chk_fail
> kexec-bzImage64: Loading purgatory failed
> 
> Can be seen:
> 
> $ readelf -a arch/x86/purgatory/purgatory.ro | grep UND
>      0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
>     51: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __stack_chk_fail
> 
> Using: gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
> 
> Adding -ffreestanding or -fno-stack-protector to ccflags-y in
> arch/x86/purgatory/Makefile
> fixes the problem. Not sure which would be preferred.
> 

Hi,
Do you have a kernel .config file that causes this?
I can't seem to reproduce it.

Thanks.
-- 
~Randy

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

* Re: x86/purgatory: undefined symbol __stack_chk_fail
  2019-09-28  0:48 ` Randy Dunlap
@ 2019-09-28 12:41   ` Ingo Molnar
  0 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2019-09-28 12:41 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Andreas Smas, linux-kernel, X86 ML


* Randy Dunlap <rdunlap@infradead.org> wrote:

> On 9/3/19 8:50 AM, Andreas Smas wrote:
> > Hi,
> > 
> > For me, kernels built including this commit
> > b059f801a937 (x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS)
> > 
> > results in kexec() failing to load the kernel:
> > 
> > kexec: Undefined symbol: __stack_chk_fail
> > kexec-bzImage64: Loading purgatory failed
> > 
> > Can be seen:
> > 
> > $ readelf -a arch/x86/purgatory/purgatory.ro | grep UND
> >      0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
> >     51: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __stack_chk_fail
> > 
> > Using: gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
> > 
> > Adding -ffreestanding or -fno-stack-protector to ccflags-y in
> > arch/x86/purgatory/Makefile
> > fixes the problem. Not sure which would be preferred.
> > 
> 
> Hi,
> Do you have a kernel .config file that causes this?
> I can't seem to reproduce it.

Does it go away with this fix in x86/urgent:

  ca14c996afe7: ("x86/purgatory: Disable the stackleak GCC plugin for the purgatory")

  git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/urgent

?

Thanks,

	Ingo

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

* Re: x86/purgatory: undefined symbol __stack_chk_fail
  2019-09-03 15:50 x86/purgatory: undefined symbol __stack_chk_fail Andreas Smas
  2019-09-28  0:48 ` Randy Dunlap
@ 2019-09-28 17:17 ` Rasmus Villemoes
  1 sibling, 0 replies; 6+ messages in thread
From: Rasmus Villemoes @ 2019-09-28 17:17 UTC (permalink / raw)
  To: Andreas Smas, linux-kernel

On 03/09/2019 17.50, Andreas Smas wrote:
> Hi,
> 
> For me, kernels built including this commit
> b059f801a937 (x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS)
> 
> results in kexec() failing to load the kernel:
> 
> kexec: Undefined symbol: __stack_chk_fail
> kexec-bzImage64: Loading purgatory failed
> 
> Can be seen:
> 
> $ readelf -a arch/x86/purgatory/purgatory.ro | grep UND
>      0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
>     51: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __stack_chk_fail
> 
> Using: gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)

Ubuntu's gcc has -fstack-protector enabled by default, so this happens
if one doesn't pass -fno-stack-protector (which I guess is implied by
-ffreestanding) explicitly.

> Adding -ffreestanding or -fno-stack-protector to ccflags-y in
> arch/x86/purgatory/Makefile
> fixes the problem. Not sure which would be preferred.

Probably -fno-stack-protector, guarded by
CONFIG_CC_HAS_STACKPROTECTOR_NONE (because not all gccs understand
-fno-stack-protector), so

ifdef CONFIG_CC_HAS_STACKPROTECTOR_NONE
ccflags-y += -fno-stack-protector
endif

Rasmus


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

* Re: x86/purgatory: undefined symbol __stack_chk_fail
  2019-09-28 21:14 Arvind Sankar
@ 2019-09-29 12:12 ` Ingo Molnar
  0 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2019-09-29 12:12 UTC (permalink / raw)
  To: Arvind Sankar; +Cc: linux-kernel, Randy Dunlap, Andreas Smas


* Arvind Sankar <nivedita@alum.mit.edu> wrote:

> On Sat, Sep 28, 2019 at 12:41:29PM +0000, Ingo Molnar wrote:
> > 
> > * Randy Dunlap <rdunlap@infradead.org> wrote:
> > 
> > > On 9/3/19 8:50 AM, Andreas Smas wrote:
> > > > Hi,
> > > > 
> > > > For me, kernels built including this commit
> > > > b059f801a937 (x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS)
> > > > 
> > > > results in kexec() failing to load the kernel:
> > > > 
> > > > kexec: Undefined symbol: __stack_chk_fail
> > > > kexec-bzImage64: Loading purgatory failed
> > > > 
> > > > Can be seen:
> > > > 
> > > > $ readelf -a arch/x86/purgatory/purgatory.ro | grep UND
> > > >      0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
> > > >     51: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __stack_chk_fail
> > > > 
> > > > Using: gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
> > > > 
> > > > Adding -ffreestanding or -fno-stack-protector to ccflags-y in
> > > > arch/x86/purgatory/Makefile
> > > > fixes the problem. Not sure which would be preferred.
> > > > 
> > > 
> > > Hi,
> > > Do you have a kernel .config file that causes this?
> > > I can't seem to reproduce it.
> > 
> > Does it go away with this fix in x86/urgent:
> > 
> >   ca14c996afe7: ("x86/purgatory: Disable the stackleak GCC plugin for the purgatory")
> > 
> >   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/urgent
> > 
> > ?
> > 
> > Thanks,
> > 
> > 	Ing
> This one was fixed by [1] e16c2983fba0f ("x86/purgatory: Change compiler
> flags from -mcmodel=kernel to -mcmodel=large to fix kexec relocation
> errors") from Steve Wahl, which in addition to changing mcmodel also
> added back -ffreestanding (and -fno-zero-initialized-in-bss). It was
> merged on the 12th. The stackleak one is a different undefined symbol
> error.
> 
> [1] https://marc.info/?l=git-commits-head&m=156829711224800

Great, so all known kexec bugs should be fixed for now in Linus's latest 
kernel, right?

Thanks,

	Ingo

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

* Re: x86/purgatory: undefined symbol __stack_chk_fail
@ 2019-09-28 21:14 Arvind Sankar
  2019-09-29 12:12 ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Arvind Sankar @ 2019-09-28 21:14 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Randy Dunlap, Andreas Smas

On Sat, Sep 28, 2019 at 12:41:29PM +0000, Ingo Molnar wrote:
> 
> * Randy Dunlap <rdunlap@infradead.org> wrote:
> 
> > On 9/3/19 8:50 AM, Andreas Smas wrote:
> > > Hi,
> > > 
> > > For me, kernels built including this commit
> > > b059f801a937 (x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS)
> > > 
> > > results in kexec() failing to load the kernel:
> > > 
> > > kexec: Undefined symbol: __stack_chk_fail
> > > kexec-bzImage64: Loading purgatory failed
> > > 
> > > Can be seen:
> > > 
> > > $ readelf -a arch/x86/purgatory/purgatory.ro | grep UND
> > >      0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
> > >     51: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __stack_chk_fail
> > > 
> > > Using: gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
> > > 
> > > Adding -ffreestanding or -fno-stack-protector to ccflags-y in
> > > arch/x86/purgatory/Makefile
> > > fixes the problem. Not sure which would be preferred.
> > > 
> > 
> > Hi,
> > Do you have a kernel .config file that causes this?
> > I can't seem to reproduce it.
> 
> Does it go away with this fix in x86/urgent:
> 
>   ca14c996afe7: ("x86/purgatory: Disable the stackleak GCC plugin for the purgatory")
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/urgent
> 
> ?
> 
> Thanks,
> 
> 	Ing
This one was fixed by [1] e16c2983fba0f ("x86/purgatory: Change compiler
flags from -mcmodel=kernel to -mcmodel=large to fix kexec relocation
errors") from Steve Wahl, which in addition to changing mcmodel also
added back -ffreestanding (and -fno-zero-initialized-in-bss). It was
merged on the 12th. The stackleak one is a different undefined symbol
error.

[1] https://marc.info/?l=git-commits-head&m=156829711224800

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

end of thread, other threads:[~2019-09-29 12:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 15:50 x86/purgatory: undefined symbol __stack_chk_fail Andreas Smas
2019-09-28  0:48 ` Randy Dunlap
2019-09-28 12:41   ` Ingo Molnar
2019-09-28 17:17 ` Rasmus Villemoes
2019-09-28 21:14 Arvind Sankar
2019-09-29 12:12 ` Ingo Molnar

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).