Re: [PATCH 09/10] nfsd: cap decoded POSIX ACL count to bound sort cost
Chuck Lever <[email protected]>
| Newsgroups | gmane.linux.nfs,gmane.linux.kernel |
|---|---|
| Organization | kernel.org |
| Message-ID | <[email protected]> |
On 5/29/26 2:41 PM, Jeff Layton wrote: > On Fri, 2026-05-29 at 14:34 -0400, Chuck Lever wrote: >> [ replaced broken email address for Trond ] >> >> On Thu, May 28, 2026, at 5:55 PM, Jeff Layton wrote: >> >>> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c >>> index c6c50c376b23..5469c6c207ba 100644 >>> --- a/fs/nfsd/nfs4xdr.c >>> +++ b/fs/nfsd/nfs4xdr.c >>> @@ -448,6 +448,8 @@ nfsd4_decode_posixacl(struct nfsd4_compoundargs >>> *argp, struct posix_acl **acl) >>> >>> if (xdr_stream_decode_u32(argp->xdr, &count) < 0) >>> return nfserr_bad_xdr; >>> + if (count > NFS_ACL_MAX_ENTRIES) >>> + return nfserr_resource; >> >> nfserr_resource is consistent with other fattr4 decoders, but >> does not make sense here, IMO. A better choice is nfserr_inval. >> > > Why not? An ACL that long doesn't violate the spec (as you pointed > out), the implementation just can't handle it. I do agree that > nfserr_resource is not the ideal error code, but it's the closest error > I can see that says "you hit an internal limitation of the server". Among other reasons, NFS4ERR_RESOURCE does not exist outside of NFSv4.0. The server is not out of resources in this case. For NFSv4.1+ NFSD's compound encoder converts it to either nfserr_rep_too_big or nfserr_rep_too_big_to_cache, neither of which are close to appropriate. Rick's NFSv4 POSIX ACL specification uses NFS4ERR_INVAL for just about every error condition. The specific meaning of INVAL is "invalid input" which is exactly what we have here. -- Chuck Lever