Date: Fri, 16 Mar 2018 13:25:26 -0700 From: Linus Torvalds <torvalds@...ux-foundation.org> To: David Laight <David.Laight@...lab.com> Cc: Florian Weimer <fweimer@...hat.com>, Kees Cook <keescook@...omium.org>, Andrew Morton <akpm@...ux-foundation.org>, Josh Poimboeuf <jpoimboe@...hat.com>, Rasmus Villemoes <linux@...musvillemoes.dk>, Randy Dunlap <rdunlap@...radead.org>, Miguel Ojeda <miguel.ojeda.sandonis@...il.com>, Ingo Molnar <mingo@...nel.org>, Ian Abbott <abbotti@....co.uk>, linux-input <linux-input@...r.kernel.org>, linux-btrfs <linux-btrfs@...r.kernel.org>, Network Development <netdev@...r.kernel.org>, Linux Kernel Mailing List <linux-kernel@...r.kernel.org>, Kernel Hardening <kernel-hardening@...ts.openwall.com> Subject: Re: [PATCH v5 0/2] Remove false-positive VLAs when using max() On Fri, Mar 16, 2018 at 10:44 AM, David Laight <David.Laight@...lab.com> wrote: > > I looked at the generated code for one of the constant sized VLA that > the compiler barfed at. > It seemed to subtract constants from %sp separately for the VLA. > So it looks like the compiler treats them as VLA even though it > knows the size. > That is probably missing optimisation. Looking at the code is definitely an option. In fact, instead of depending on -Wvla, we could just make 'objtool' warn about real variable-sized stack frames. That said, if that "sizeof()" trick of Al's actually works with older gcc versions too (it *should*, but it's not like __builtin_choose_expr() and __builtin_constant_p() have well-defined rules in the standard), that may just be the solution. And if gcc ends up generating bad code for those "constant sized vlas" anyway, then -Wvla would effectively warn about that code generation problem. Linus
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.