Subject: Re: file id alignment
To: None <tech-kern@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
Date: 06/30/2006 23:47:45
>>>> - struct tmpfs_fid *tfhp;
>>>> + struct tmpfs_fid tfh;
>>> you need to ensure that any padding bytes in tfh are properly
>> Why? If they're padding bytes, by definition they do not belong to
>> any of the struct fields and anything depending on them is broken.
> IIRC, these are used to form NFS file handles. NFS clients will
> bcmp() file handles for various purposes.
Then the code for creating file handles from structs tmpfs_fid is
broken, in that it depends on padding bytes in invalid ways.
If the code neither (a) ensures there are no padding bytes nor (b)
ensures the file handles are constructed in ways that avoid including
the values of any possible padding bytes in file handles, the code is
just plain *broken*.
> It's important for the NFS server to construct and return identical
> file handles for a given file. Zero-filling the padding is
If zero-filling the padding is in any sense necessary, there is
something somewhere else that's broken.
Unless gcc promises more than C does about padding bytes, that is. I
can't recall seeing any such promise in the gcc doc; did I miss one?
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML email@example.com
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B