tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kernel stack usage



Le sam. 4 juil. 2020 à 15:30, Kamil Rytarowski <kamil%netbsd.org@localhost> a écrit :
> > Kamil - what's the difference in gcc between -Wframe-larger-than= and
> > -Wstack-size= ?
> >
>
> -Wstack-size doesn't exist?

Sorry, meant -Wstack-usage=

> > I see according to gcc documentation -Wframe-larger-than doesn't count
> > size for alloca() and variable-length arrays, which makes it much less
> > useful than -Wstack-usage.
> >
>
> It's not a problem.
>
> Whenever alloca or VLA is in use, it's already breaking the stack
> protector. There are a few exceptions registered in sys/conf/ssp.mk.
>
> We could add -Walloca -Wvla for USE_SSP=yes builds to catch quickly
> inappropriate usage (frequently violated by code optimizer).

It's already not used in our kernel code, I checked and I found it
used only in some arch-specific stand/ code. So -Walloca should be
safe to turn on unconditionally, regardless of SSP. Unless the
compiler emits alloca() calls itself.

Jaromir


Home | Main Index | Thread Index | Old Index