Re: [PATCH v2] Introduce a version6 of autofs interface, to fix designerror.

From: H. Peter Anvin
Date: Fri Apr 27 2012 - 16:42:35 EST


On 04/27/2012 11:19 AM, Linus Torvalds wrote:
>
> Btw, the whole autofs protocol is *full* of stuff like this. I just
> looked at some other places where the automount daemon does reads of
> fixed sizes, and one of them is a "sizeof(enum states)". Doing a
> sizeof() on an enum is a f*cking bad idea - it's not very well-defined
> at all (different compilers will consider the enum different sizes -
> seriously). But at least that one seems to be something that is purely
> internal to autofs - but it does show that the people involved did not
> think through and design the protocols they used in general - more of
> these kinds of "random sizes of random data structures that we don't
> understand".
>

The really *really* damning thing with the v5 structure is that it
padded out the whole structure so it wouldn't have to do two read()
operations. There is a header with a length field in it (which is still
there), and the daemon just ignores it...

-hpa


P.S. This can still be fixed in user space, by reading the shorter
length, and then eating any additional zeroes. The kernel does zero out
the extra pad.

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