[Bug 192640] New: [PATCH] nfsclient: Fix struct padding assumption in DIRHDSIZ

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Aug 13 16:47:29 UTC 2014


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192640

            Bug ID: 192640
           Summary: [PATCH] nfsclient: Fix struct padding assumption in
                    DIRHDSIZ
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: Needs Triage
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: conrad.meyer at isilon.com

Created attachment 145758
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=145758&action=edit
(applies with -p0 in CURRENT svn tree)

Both the old and new nfsclient code's DIRHDSIZ macro make the assumption that
'struct dirent' has no padding following d_name. (That the macro is defined
seperately in 3 different .c files is a separate issue.) As a result, if the
dirent structure is changed to add 64-bit members (one of a few ABI changes in
OneFS), padding is added at the end of the struct and DIRHDSIZ becomes invalid
(4 bytes too big).

This patch changes the definition of DIRHDSIZ to use __offsetof(struct dirent,
d_name) instead, which will always be correct.

It fixes the DIRHDSIZ definition in the old nfsclient as well as new; if the
old one will be killed shortly, there's no need to take that change.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list