Re: Linux 5.8-rc1

From: Gabriel C
Date: Tue Jun 16 2020 - 17:17:40 EST


Am Di., 16. Juni 2020 um 22:33 Uhr schrieb Arvind Sankar
<nivedita@xxxxxxxxxxxx>:
>
> On Tue, Jun 16, 2020 at 10:11:46PM +0200, Gabriel C wrote:
> > * Am So., 14. Juni 2020 um 22:44 Uhr schrieb Linus Torvalds
> > <torvalds@xxxxxxxxxxxxxxxxxxxx>:
> >
> > Hello,
> >
> > > So I didn't really expect this, but 5.8 looks to be one of our biggest
> > > releases of all time.
> > >
> >
> > I hit a compiler error caused by e4160b2e4b02377c67f8ecd05786811598f39acd.
> >
> > x86/purgatory: Fail the build if purgatory.ro has missing symbols
> >
> > Having CONFIG_STACKPROTECTOR* & CONFIG_KEXEC_FILE enabled always
> > results in a linking error like this:
> >
> > LD arch/x86/purgatory/purgatory.chk
> > ld: arch/x86/purgatory/purgatory.ro: in function `verify_sha256_digest':
> > purgatory.c:(.text+0x108): undefined reference to `__stack_chk_fail'
> > ld: arch/x86/purgatory/purgatory.ro: in function `sha256_transform':
> > sha256.c:(.text+0x1c74): undefined reference to `__stack_chk_fail'
> > ld: arch/x86/purgatory/purgatory.ro: in function `__sha256_final':
> > sha256.c:(.text+0x1e65): undefined reference to `__stack_chk_fail'
> > ld: arch/x86/purgatory/purgatory.ro: in function `_kstrtoull':
> > string.c:(.text+0x2107): undefined reference to `__stack_chk_fail'
> >
> > I didn't look closer at that but from the error, it seems to be,
> > some missing -fstack-protector* vs -fno-stack-protector* checks
> > somewhere.
> >
> >
> > Best Regards,
> >
> > Gabriel C
>
> Can you attach the output of gcc -dumpspecs and gcc -v? I suspect your
> compiler enables stack protector by default. My distro compiler does
> that too, but not if -ffreestanding is enabled (which it is for the
> purgatory).
>

Files including config uploaded to there:

http://crazy.dev.frugalware.org/kernel/

> Does this patch help?
>

I'll test in a bit and let you know.

> diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile
> index b04e6e72a592..088bd764e0b7 100644
> --- a/arch/x86/purgatory/Makefile
> +++ b/arch/x86/purgatory/Makefile
> @@ -34,6 +34,7 @@ KCOV_INSTRUMENT := n
> PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel
> PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss
> PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN) -DDISABLE_BRANCH_PROFILING
> +PURGATORY_CFLAGS += $(call cc-option,-fno-stack-protector)
>
> # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That
> # in turn leaves some undefined symbols like __fentry__ in purgatory and not

Thx.