Page MenuHomeFreeBSD

nfsclient: Copy only initialized fields in nfs_getattr()
ClosedPublic

Authored by markj on May 3 2021, 1:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 20, 5:57 PM
Unknown Object (File)
Tue, Dec 10, 5:28 AM
Unknown Object (File)
Sun, Dec 8, 12:11 PM
Unknown Object (File)
Nov 29 2024, 9:29 PM
Unknown Object (File)
Nov 18 2024, 8:20 PM
Unknown Object (File)
Nov 18 2024, 2:14 PM
Unknown Object (File)
Nov 7 2024, 3:52 PM
Unknown Object (File)
Oct 23 2024, 9:09 AM
Subscribers

Details

Summary

When loading attributes from the cache, the NFS client is careful to
copy only the fields that it initialized. After fetching attributes
from the server, however, it would copy the entire vattr structure
initialized from the RPC response, so uninitialized stack bytes would
end up being copied to userspace. In particular, va_btime (v2 and v3)
and va_gen (v3) had this problem.

Use a common subroutine to copy fields provided by the NFS client, and
ensure that we provide a dummy va_gen for the v3 case.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 38980
Build 35869: arc lint + arc unit

Event Timeline

markj requested review of this revision.May 3 2021, 1:31 PM

Looks fine to me. Until I just looked, I didn't realize
that the NFSv4 client doesn't get birthtime.
I'll add that to my todo list, but this patch looks
fine until then.

This revision is now accepted and ready to land.May 3 2021, 9:15 PM