[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <fc900727-b79f-b22a-4ae5-8774c2feab84@rasmusvillemoes.dk>
Date: Sat, 28 Sep 2019 19:17:55 +0200
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: Andreas Smas <andreas@...elycoder.com>,
linux-kernel@...r.kernel.org
Subject: Re: x86/purgatory: undefined symbol __stack_chk_fail
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
Powered by blists - more mailing lists