Re: gcc-10: kernel stack is corrupted and fails to boot

From: Arnd Bergmann
Date: Wed May 13 2020 - 17:28:34 EST


On Wed, May 13, 2020 at 5:48 PM Arvind Sankar <nivedita@xxxxxxxxxxxx> wrote:
>
> On Wed, May 13, 2020 at 09:50:03AM +0300, Kalle Valo wrote:

> > And now I have a problem :) I first noticed that my x86 testbox is not
> > booting when I compile the kernel with GCC 10.1.0 from crosstool. I
> > didn't get any error messages so I just downgraded the compiler and the
> > kernel was booting fine again. Next I decided to try GCC 10.1 with my
> > x86 laptop and it also failed to boot, but this time I got kernel logs
> > and saw this:
> >
> > Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: start_secodary+0x178/0x180
> >
>
> See https://lore.kernel.org/lkml/20200423161126.GD26021@xxxxxxx/

Thanks!

I see the patch in linux-next but not in mainline. I suppose we want it in v5.7
and backported to stable kernels so they can boot when built with gcc-10?

I suppose the only reason that the other architectures don't run into the
problem is that they don't call boot_init_stack_canary() in start_secondary()
though they probably should?

Arnd