Re: [PATCH 06/31] e2p: Fix f[gs]etflags argument size mismatch

Theodore Ts'o
2013-10-07T13:33:06Z

On Mon, Sep 30, 2013 at 06:27:21PM -0700, Darrick J. Wong wrote:

> The EXT2_IOC_[GS]ETFLAGS ioctls take longs as arguments, however
> this code only reserves enough storage for an int. The kernel
> drivers (so far) don't transfer more than an int but FUSE sees the
> long and assumes that it's ok to write the full size of the long,
> which crashes if sizeof(long) > sizeof(int).

All of the kernel code I was able to audit is treating the
EXT2_IOC_[SG]ETFLAGS ioctls as taking an int, not a long. So the
defacto definition of [SG]ETFLAGS is that that they take ints, not
longs. If we make this change which you are proposing, it will cause
problems on big-endian systems where sizeof(long) > sizeof(int) ---
for example, as would be the case on the ppc64 architecture.

I'm not sure what the FUSE problem is? Can you say more? Is there
some other way we can work around the problem you are trying to solve?

- Ted