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

2020-05-14 Thread Arvind Sankar
On Thu, May 14, 2020 at 10:40:44AM +0200, Arnd Bergmann wrote: > On Thu, May 14, 2020 at 7:22 AM Arvind Sankar wrote: > > On Wed, May 13, 2020 at 09:52:07PM -0700, Linus Torvalds wrote: > > > On Wed, May 13, 2020, 20:50 Andy Lutomirski wrote: > > The gcc docs [1,2] at least don't inspire much con

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

2020-05-14 Thread Harald Arnesen
Kalle Valo [13.05.2020 17:31]: > Great, so it's not a problem due to my setup. I see the same thing on two machines, using a self-compiled gcc 10.1.0. Glad to hear it's not just me. Switched back to 9.3.0 for the time being. -- Hilsen Harald

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

2020-05-14 Thread Arnd Bergmann
On Thu, May 14, 2020 at 7:22 AM Arvind Sankar wrote: > On Wed, May 13, 2020 at 09:52:07PM -0700, Linus Torvalds wrote: > > On Wed, May 13, 2020, 20:50 Andy Lutomirski wrote: > The gcc docs [1,2] at least don't inspire much confidence that this will > continue working with plain asm("") though: >

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

2020-05-14 Thread David Laight
From: Linus Torvalds > Sent: 14 May 2020 03:20 > On Wed, May 13, 2020 at 5:51 PM Nick Desaulniers > wrote: > > > > Are you sure LTO treats empty asm statements differently than full > > memory barriers in regards to preventing tail calls? > > It had better. > > At link-time, there is nothing lef

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

2020-05-13 Thread Arvind Sankar
On Wed, May 13, 2020 at 09:52:07PM -0700, Linus Torvalds wrote: > On Wed, May 13, 2020, 20:50 Andy Lutomirski wrote: > > > > > LTO isn’t a linker taking regular .o files full of regular machine > > code and optimizing it. That’s nuts. > > > > Yeah, you're right. I wear originally thinking just a

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

2020-05-13 Thread Andy Lutomirski
> On May 13, 2020, at 7:20 PM, Linus Torvalds > wrote: > > On Wed, May 13, 2020 at 5:51 PM Nick Desaulniers > wrote: >> >> Are you sure LTO treats empty asm statements differently than full >> memory barriers in regards to preventing tail calls? > > It had better. > > At link-time, there is not

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

2020-05-13 Thread Linus Torvalds
On Wed, May 13, 2020 at 5:51 PM Nick Desaulniers wrote: > > Are you sure LTO treats empty asm statements differently than full > memory barriers in regards to preventing tail calls? It had better. At link-time, there is nothing left of an empty asm statement. So by the time the linker runs, it o

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

2020-05-13 Thread Nick Desaulniers
On Wed, May 13, 2020 at 5:11 PM Linus Torvalds wrote: > > On Wed, May 13, 2020 at 4:36 PM Borislav Petkov wrote: > > > > > > Looking at them, they do have an mb() too so how about this then > > instead? > > > > #define prevent_tail_call_optimization()mb() > > Yeah, I think a full mb() is

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

2020-05-13 Thread Linus Torvalds
On Wed, May 13, 2020 at 4:36 PM Borislav Petkov wrote: > > > Looking at them, they do have an mb() too so how about this then > instead? > > #define prevent_tail_call_optimization()mb() Yeah, I think a full mb() is likely safe, because that's pretty much always going to be a real instruct

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

2020-05-13 Thread Borislav Petkov
On Wed, May 13, 2020 at 04:13:53PM -0700, Linus Torvalds wrote: > The check itself doesn't seem worth it. If your worry is that an empty > asm() can be optimized away, then don't use an empty asm! gcc guys said we should use that since the first attempt using __attribute__((optimize("-fno-stack-p

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

2020-05-13 Thread Linus Torvalds
On Wed, May 13, 2020 at 3:20 PM Borislav Petkov wrote: > > Linus, shout if you'd prefer only the last three commits there: > > 950a37078aa0 x86/build: Use $(CONFIG_SHELL) > f670269a42bf x86: Fix early boot crash on gcc-10, next try > 73da86741e7f x86/build: Check whether the compiler is sane Do w

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

2020-05-13 Thread Linus Torvalds
On Wed, May 13, 2020 at 2:50 PM Arnd Bergmann wrote: > > Right, in particular since Linus started building with gcc-10 already and > would likely soon run into that problem if he hasn't already ;-) I don't happen to have stack canaries on the configs I actually boot, so I didn't notice. But yes,

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

2020-05-13 Thread Arvind Sankar
On Thu, May 14, 2020 at 12:20:38AM +0200, Borislav Petkov wrote: > On Wed, May 13, 2020 at 11:49:49PM +0200, Arnd Bergmann wrote: > > Right, in particular since Linus started building with gcc-10 already and > > would likely soon run into that problem if he hasn't already ;-) > > Oh noo, we don't

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

2020-05-13 Thread Borislav Petkov
On Wed, May 13, 2020 at 11:49:49PM +0200, Arnd Bergmann wrote: > Right, in particular since Linus started building with gcc-10 already and > would likely soon run into that problem if he hasn't already ;-) Oh noo, we don't want Linus' kernel broken. ;-) We will send him the fix this weekend. Loo

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

2020-05-13 Thread Arnd Bergmann
On Wed, May 13, 2020 at 11:41 PM Borislav Petkov wrote: > > On Wed, May 13, 2020 at 11:28:09PM +0200, Arnd Bergmann wrote: > > 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? > > It is

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

2020-05-13 Thread Borislav Petkov
On Wed, May 13, 2020 at 11:28:09PM +0200, Arnd Bergmann wrote: > 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? It is queued for 5.8. For a good reason, if you read the whole thread Arvin

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

2020-05-13 Thread Arnd Bergmann
On Wed, May 13, 2020 at 5:48 PM Arvind Sankar 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

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

2020-05-13 Thread David Laight
From: Arnd Bergmann > Sent: 13 May 2020 17:00 > On Wed, May 13, 2020 at 5:31 PM Kalle Valo wrote: ... > I investigated a little more: This does happen with 'defconfig' > after all, in my first try I must have missed the '-smp 2' argument > to qemu, and it ended up working correctly with just one C

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

2020-05-13 Thread Arnd Bergmann
On Wed, May 13, 2020 at 5:31 PM Kalle Valo wrote: > Arnd Bergmann writes: > > On Wed, May 13, 2020 at 2:57 PM Kalle Valo wrote: > >> > >> Arnd Bergmann writes: > >> > >> > If you share your .config, I can try reproducing with that as well. > >> > Once there is a reproducer in qemu, it should be

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

2020-05-13 Thread Arvind Sankar
On Wed, May 13, 2020 at 09:50:03AM +0300, Kalle Valo wrote: > (trimming CC, changing title) > > Kalle Valo writes: > > > Kalle Valo writes: > > > >> Arnd Bergmann writes: > >> > >>> gcc-10 correctly points out a bug with a zero-length array in > >>> struct ath10k_pci: > >>> > >>> drivers/net/w

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

2020-05-13 Thread Kalle Valo
Arnd Bergmann writes: > On Wed, May 13, 2020 at 2:57 PM Kalle Valo wrote: >> >> Arnd Bergmann writes: >> >> > On Wed, May 13, 2020 at 8:50 AM Kalle Valo wrote: >> >> >> >> Kalle Valo writes: >> > >> > At least if it fails reproducibly, it's probably not too hard to drill >> > down further. So

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

2020-05-13 Thread Arnd Bergmann
On Wed, May 13, 2020 at 2:57 PM Kalle Valo wrote: > > Arnd Bergmann writes: > > > On Wed, May 13, 2020 at 8:50 AM Kalle Valo wrote: > >> > >> Kalle Valo writes: > > > > At least if it fails reproducibly, it's probably not too hard to drill > > down further. Some ideas: > > > > * I'd first try t

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

2020-05-13 Thread Kalle Valo
Arnd Bergmann writes: > On Wed, May 13, 2020 at 8:50 AM Kalle Valo wrote: >> >> Kalle Valo writes: >> >> > This motivated me to switch to using GCC 10.x and I noticed that you had >> > already upgraded crosstool so it was a trivial thing to do, awesome :) >> > >> > https://mirrors.edge.kernel.o

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

2020-05-13 Thread Arnd Bergmann
On Wed, May 13, 2020 at 8:50 AM Kalle Valo wrote: > > Kalle Valo writes: > > > This motivated me to switch to using GCC 10.x and I noticed that you had > > already upgraded crosstool so it was a trivial thing to do, awesome :) > > > > https://mirrors.edge.kernel.org/pub/tools/crosstool/ > > And n