Re: CVE-2014-9900 fix is not upstream
From: Al Viro
Date: Tue Aug 23 2016 - 17:26:52 EST
On Tue, Aug 23, 2016 at 04:49:33PM -0400, Lennart Sorensen wrote:
> That would be padding after the structure elements.
>
> I think what was meant is that it won't add padding in the middle of the
> structure due to alignment, ie it isn't doing:
>
> struct ethtool_wolinfo {
> __u32 cmd; /* 0 4 */
> __u32 supported; /* 4 4 */
> __u32 wolopts; /* 8 4 */
> <4 bytes padding here>
> __u8 sopass[6]; /* 16 6 */
> };
>
> which would have 4 bytes of padding in the middle between wolopts
> and sopass.
>
> I would not think it is the compilers job to worry about what is after
> your structure elements, since you shouldn't be going there.
Sadly, sizeof is what we use when copying that sucker to userland. So these
padding bits in the end would've leaked, true enough, and the case is somewhat
weaker. And any normal architecture will have those, but then any such
architecture will have no more trouble zeroing a 32bit value than 16bit one.