Skip to content

NAS-140938 / 26.0.0-RC.1 / nfsd: encode FATTR4_DACL via per-bit dispatch table (by anodos325)#266

Merged
anodos325 merged 2 commits intostable/26from
NAS-140938-26.0.0-RC.1
May 8, 2026
Merged

NAS-140938 / 26.0.0-RC.1 / nfsd: encode FATTR4_DACL via per-bit dispatch table (by anodos325)#266
anodos325 merged 2 commits intostable/26from
NAS-140938-26.0.0-RC.1

Conversation

@bugclerk
Copy link
Copy Markdown

@bugclerk bugclerk commented May 8, 2026

DACL was encoded in a post-loop block that ran after the bitmap- iteration encoder had emitted higher-numbered attributes. When a client requested DACL together with any attribute numbered > 58 (e.g. FATTR4_XATTR_SUPPORT = 82), the DACL bytes landed after the higher-numbered attribute on the wire, violating RFC 8881 §3.3.7's attribute-number ordering and causing clients to decode garbage at the DACL slot.

Add nfsd4_encode_fattr4_dacl(), register it at FATTR4_DACL in nfsd4_enc_fattr4_encode_ops[], and move the dacl pointer onto struct nfsd4_fattr_args so it flows through the dispatch path.

Also gate the DACL fetch in nfsd4_encode_fattr4() on IS_NFSV4ACL so GETATTR/READDIR matches what supported_attrs advertises and what the SETATTR check in nfs4proc.c enforces; otherwise a client ignoring supported_attrs receives a flag=0 POSIX-translated fake DACL.

This bug was discovered by customer using non-Linux NFSv4 client.

Original PR: #264

anodos325 added 2 commits May 8, 2026 19:00
DACL was encoded in a post-loop block that ran after the bitmap-
iteration encoder had emitted higher-numbered attributes.  When a
client requested DACL together with any attribute numbered > 58 (e.g.
FATTR4_XATTR_SUPPORT = 82), the DACL bytes landed after the
higher-numbered attribute on the wire, violating RFC 8881 §3.3.7's
attribute-number ordering and causing clients to decode garbage at
the DACL slot.

Add nfsd4_encode_fattr4_dacl(), register it at FATTR4_DACL in
nfsd4_enc_fattr4_encode_ops[], and move the dacl pointer onto
struct nfsd4_fattr_args so it flows through the dispatch path.

Also gate the DACL fetch in nfsd4_encode_fattr4() on IS_NFSV4ACL so
GETATTR/READDIR matches what supported_attrs advertises and what the
SETATTR check in nfs4proc.c enforces; otherwise a client ignoring
supported_attrs receives a flag=0 POSIX-translated fake DACL.

This bug was discovered by customer using non-Linux NFSv4 client.

(cherry picked from commit b92a9de)
Add note for future developers to not break our encoding here.

(cherry picked from commit b1f0edc)
@bugclerk
Copy link
Copy Markdown
Author

bugclerk commented May 8, 2026

@anodos325 anodos325 merged commit 2ba6882 into stable/26 May 8, 2026
6 checks passed
@anodos325 anodos325 deleted the NAS-140938-26.0.0-RC.1 branch May 8, 2026 19:24
@bugclerk
Copy link
Copy Markdown
Author

bugclerk commented May 8, 2026

This PR has been merged and conversations have been locked.
If you would like to discuss more about this issue please use our forums or raise a Jira ticket.

@truenas truenas locked as resolved and limited conversation to collaborators May 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants