Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 16 Mar 2018 17:44:52 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Linus Torvalds' <torvalds@...ux-foundation.org>, Florian Weimer
	<fweimer@...hat.com>
CC: 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()

From: Linus Torvalds
> Sent: 16 March 2018 17:29
> On Fri, Mar 16, 2018 at 4:47 AM, Florian Weimer <fweimer@...hat.com> wrote:
> >
> > If you want to catch stack frames which have unbounded size,
> > -Werror=stack-usage=1000 or -Werror=vla-larger-than=1000 (with the constant
> > adjusted as needed) might be the better approach.
> 
> No, we want to catch *variable* stack sizes.
> 
> Does "-Werror=vla-larger-than=0" perhaps work for that? No, because
> the stupid compiler says that is "meaningless".
> 
> And no, using "-Werror=vla-larger-than=1" doesn't work either, because
> the moronic compiler continues to think that "vla" is about the
> _type_, not the code:
> 
>    t.c: In function ‘test’:
>    t.c:6:6: error: argument to variable-length array is too large
> [-Werror=vla-larger-than=]
>      int array[(1,100)];
> 
> Gcc people are crazy.
> 
> Is there really no way to just say "shut up about the stupid _syntax_
> issue that is entirely irrelevant, and give us the _code_ issue".

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.

	David

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.