[PATCH 1/2] kbuild: add '-fno-stack-check' to barebox build options

Sascha Hauer sha at pengutronix.de
Mon Mar 22 05:12:16 GMT 2021


On Tue, Mar 16, 2021 at 08:10:45PM +0100, Ahmad Fatoum wrote:
> Hello Sascha,
> 
> On 24.02.21 09:49, Sascha Hauer wrote:
> > On Tue, Feb 23, 2021 at 08:24:26AM +0100, Ahmad Fatoum wrote:
> >> This ports over Linux commit 3ce120b16cc5 ("kbuild: add
> >> '-fno-stack-check' to kernel build options"):
> >>
> >>   Author:     Linus Torvalds <torvalds at linux-foundation.org>
> >>
> >>     kbuild: add '-fno-stack-check' to kernel build options
> >>
> >>     It appears that hardened gentoo enables "-fstack-check" by default for
> >>     gcc.
> >>
> >>     That doesn't work _at_all_ for the kernel, because the kernel stack
> >>     doesn't act like a user stack at all: it's much smaller, and it doesn't
> >>     auto-expand on use.  So the extra "probe one page below the stack" code
> >>     generated by -fstack-check just breaks the kernel in horrible ways,
> >>     causing infinite double faults etc.
> >>
> >>     [ I have to say, that the particular code gcc generates looks very
> >>       stupid even for user space where it works, but that's a separate
> >>       issue.  ]
> >>
> >>     Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
> >>
> >> I am porting it, because it may become more acute with the incoming
> >> support for multiple stacks (via initjmp).
> >>
> >> Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
> >> ---
> > 
> > Applied, thanks
> 
> Can't find both patches in next.

They should be there now.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list