Otherwise cd9660's VOP_VPTOFH can overflow the output buffer.
Reported by: Kevin Miller <mas@0x194.net>
Differential D47879
cd9660: Make sure that struct ifid fits in generic filehandle structure markj on Tue, Dec 3, 3:25 PM. Authored by
Details
Diff Detail
Event Timeline
Comment Actions I think more relevant question there are compilers generate proper code to access unaligned ifid_ino and ifid_start on sensitive arches. It might be that the better fix is to re-order members without introducing __packed. There is no ABI involved. Comment Actions They have to, else the packed attribute would just be useless. Bugs should be filed against those that don't.
That doesn't seem possible as len and pad must stay first. Comment Actions
I mentioned in a secteam chat that we should have a comment about unaligned access in arch(7). (The only comment we have right now is Most ILP32 ABIs, except arm, require only 4-byte alignment for 64-bit integers.) ifid starting with a u_short ifid_len matches the fid_len at the beginning of struct fid; does anything make use of that? Comment Actions Yes, that would be a major compiler bug, I hope..
As far as I can see, this isn't true - the layout is up to the filesystem. The filesystem just needs to guarantee that fh1 == fh2 implies that the two FIDs refer to the same file. I can't see any NFS code which peeks into the fid structure. Perhaps @rmacklem can confirm? But, it doesn't make much sense to have len be anywhere other than the first field. Comment Actions As far as I know, the NFS server code does not look inside the fid structure. I will note that the NFS server code zeros out the fh_fid before making VFS/VOP calls, rick structure's size doesn't exceed sizeof(struct fid)?
|