lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A08DDE2.1080708@garzik.org>
Date:	Mon, 11 May 2009 22:24:34 -0400
From:	Jeff Garzik <jeff@...zik.org>
To:	Ingo Molnar <mingo@...e.hu>
CC:	Rusty Russell <rusty@...tcorp.com.au>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Mike Travis <travis@....com>,
	LKML <linux-kernel@...r.kernel.org>, viro@...iv.linux.org.uk,
	Andrew Morton <akpm@...ux-foundation.org>, roland@...hat.com
Subject: Re: [RFC PATCH 2/2] kernel/sched.c: VLA in middle of struct

Ingo Molnar wrote:
>>>>> That cpumask[] should probably be cpumask[0], to document the
>>>>> aliasing to ->span and ->cpus properly.
>>>> If the comment wasn't sufficient documentation, I don't think that  
>>>> would help :(
>>> It's a visual helper: it matches up with how we do these 'zero size  
>>> array means dynamic structure continuation' tricks generally.
>>>
>>> I first mis-parsed the code for a second when seeing cpumask[].  
>>> cpumask[0] stands out like a sore thumb. And we dont read comments  
>>> anyway ;-)
>>>
>>> Jeff, i suspect you found this because you are working on something  
>>> rather interesting? :) If yes, would it help your project if we did  
>>> the cpumask[0] cleanup and pushed it upstream immediately?
>> I think cpumask[0] would be more clear and consistent with the 
>> rest of the kernel.
>>
>> But unfortunately for the twin projects of (a) static analysis and 
>> checking with 'sparse', and (b) compiling under another compiler, 
>> VLA-in-middle-of-struct is a killer in either case.
> 
> even if at the end of the struct?

Putting the VLA at the end of the struct would be a huge help, yes.

For example, struct sched_group and struct sched_domain are OK as-is 
(though "[0]" would be preferred).

It is the definition of struct static_sched_group and struct 
static_sched_domain that creates the problem, because with the bitmap 
following cpumask[] and span[], the VLA is no longer at the end of the 
struct.

VLA-in-the-middle raises the complexity required of the compiler quite a 
bit.  As a result, VLA-in-middle is not implemented in sparse or clang 
(LLVM's C front-end and static analyzer).

	Jeff



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ