public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6.6.y 0/4] NFSD: NFSv4 file creation neglects setting ACL
@ 2026-01-03 19:38 Chuck Lever
  2026-01-03 19:38 ` [PATCH 6.6.y 1/4] nfsd: convert to new timestamp accessors Chuck Lever
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Chuck Lever @ 2026-01-03 19:38 UTC (permalink / raw)
  To: stable; +Cc: linux-nfs, Greg Kroah-Hartman, Sasha Levin, Chuck Lever

From: Chuck Lever <chuck.lever@oracle.com>

I received an automated report that patch "NFSD: NFSv4 file creation
neglects setting ACL" failed to apply to the 6.6-stable tree. This
series is my attempt to address that failure.

- First, applied several pre-requisite patches
- LLM agent review for possible regressions reported no issues
- CI testing reported no regressions

Chuck Lever (4):
  nfsd: convert to new timestamp accessors
  nfsd: Fix NFSv3 atomicity bugs in nfsd_setattr()
  nfsd: set security label during create operations
  NFSD: NFSv4 file creation neglects setting ACL

 fs/nfsd/nfs3proc.c  | 10 ++++++----
 fs/nfsd/nfs3xdr.c   |  5 +----
 fs/nfsd/nfs4proc.c  | 11 +++++------
 fs/nfsd/nfs4state.c |  2 +-
 fs/nfsd/nfsctl.c    |  2 +-
 fs/nfsd/nfsproc.c   |  6 +++---
 fs/nfsd/vfs.c       | 22 ++++++++++++++--------
 fs/nfsd/vfs.h       | 11 ++++++++++-
 fs/nfsd/xdr3.h      |  2 +-
 9 files changed, 42 insertions(+), 29 deletions(-)

-- 
2.52.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 6.6.y 1/4] nfsd: convert to new timestamp accessors
  2026-01-03 19:38 [PATCH 6.6.y 0/4] NFSD: NFSv4 file creation neglects setting ACL Chuck Lever
@ 2026-01-03 19:38 ` Chuck Lever
  2026-01-08 11:03   ` Greg Kroah-Hartman
  2026-01-08 12:33   ` Greg Kroah-Hartman
  2026-01-03 19:38 ` [PATCH 6.6.y 2/4] nfsd: Fix NFSv3 atomicity bugs in nfsd_setattr() Chuck Lever
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Chuck Lever @ 2026-01-03 19:38 UTC (permalink / raw)
  To: stable; +Cc: linux-nfs, Greg Kroah-Hartman, Sasha Levin, Chuck Lever

From: Chuck Lever <chuck.lever@oracle.com>

[ Upstream commit 335a7be84b526861f3deb4fdd5d5c2a48cf1feef ]

[ cel: adjust to the 6.6.y version of fs/nfsd/blocklayout.c ]
Stable-dep-of: 24d92de9186e ("nfsd: Fix NFSv3 atomicity bugs in nfsd_setattr()")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs3proc.c | 4 ++--
 fs/nfsd/nfs4proc.c | 8 ++++----
 fs/nfsd/nfsctl.c   | 2 +-
 fs/nfsd/vfs.c      | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 268ef57751c4..666bad8182e5 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -294,8 +294,8 @@ nfsd3_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp,
 			status = nfserr_exist;
 			break;
 		case NFS3_CREATE_EXCLUSIVE:
-			if (d_inode(child)->i_mtime.tv_sec == v_mtime &&
-			    d_inode(child)->i_atime.tv_sec == v_atime &&
+			if (inode_get_mtime_sec(d_inode(child)) == v_mtime &&
+			    inode_get_atime_sec(d_inode(child)) == v_atime &&
 			    d_inode(child)->i_size == 0) {
 				break;
 			}
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 886c09267544..37b918e4a53d 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -322,8 +322,8 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp,
 			status = nfserr_exist;
 			break;
 		case NFS4_CREATE_EXCLUSIVE:
-			if (d_inode(child)->i_mtime.tv_sec == v_mtime &&
-			    d_inode(child)->i_atime.tv_sec == v_atime &&
+			if (inode_get_mtime_sec(d_inode(child)) == v_mtime &&
+			    inode_get_atime_sec(d_inode(child)) == v_atime &&
 			    d_inode(child)->i_size == 0) {
 				open->op_created = true;
 				break;		/* subtle */
@@ -331,8 +331,8 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp,
 			status = nfserr_exist;
 			break;
 		case NFS4_CREATE_EXCLUSIVE4_1:
-			if (d_inode(child)->i_mtime.tv_sec == v_mtime &&
-			    d_inode(child)->i_atime.tv_sec == v_atime &&
+			if (inode_get_mtime_sec(d_inode(child)) == v_mtime &&
+			    inode_get_atime_sec(d_inode(child)) == v_atime &&
 			    d_inode(child)->i_size == 0) {
 				open->op_created = true;
 				goto set_attr;	/* subtle */
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 887035b74467..81e0b4726567 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1140,7 +1140,7 @@ static struct inode *nfsd_get_inode(struct super_block *sb, umode_t mode)
 	/* Following advice from simple_fill_super documentation: */
 	inode->i_ino = iunique(sb, NFSD_MaxReserved);
 	inode->i_mode = mode;
-	inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
+	simple_inode_init_ts(inode);
 	switch (mode & S_IFMT) {
 	case S_IFDIR:
 		inode->i_fop = &simple_dir_operations;
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 5ee7149ceaa5..1faf65147223 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -521,7 +521,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
 
 	nfsd_sanitize_attrs(inode, iap);
 
-	if (check_guard && guardtime != inode_get_ctime(inode).tv_sec)
+	if (check_guard && guardtime != inode_get_ctime_sec(inode))
 		return nfserr_notsync;
 
 	/*
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6.6.y 2/4] nfsd: Fix NFSv3 atomicity bugs in nfsd_setattr()
  2026-01-03 19:38 [PATCH 6.6.y 0/4] NFSD: NFSv4 file creation neglects setting ACL Chuck Lever
  2026-01-03 19:38 ` [PATCH 6.6.y 1/4] nfsd: convert to new timestamp accessors Chuck Lever
@ 2026-01-03 19:38 ` Chuck Lever
  2026-01-03 19:38 ` [PATCH 6.6.y 3/4] nfsd: set security label during create operations Chuck Lever
  2026-01-03 19:38 ` [PATCH 6.6.y 4/4] NFSD: NFSv4 file creation neglects setting ACL Chuck Lever
  3 siblings, 0 replies; 9+ messages in thread
From: Chuck Lever @ 2026-01-03 19:38 UTC (permalink / raw)
  To: stable
  Cc: linux-nfs, Greg Kroah-Hartman, Sasha Levin, Chuck Lever,
	Jeff Layton, NeilBrown

From: Chuck Lever <chuck.lever@oracle.com>

[ Upstream commit 24d92de9186ebc340687caf7356e1070773e67bc ]

nfsd: Fix NFSv3 atomicity bugs in nfsd_setattr()

The main point of the guarded SETATTR is to prevent races with other
WRITE and SETATTR calls. That requires that the check of the guard time
against the inode ctime be done after taking the inode lock.

Furthermore, we need to take into account the 32-bit nature of
timestamps in NFSv3, and the possibility that files may change at a
faster rate than once a second.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: NeilBrown <neilb@suse.de>
Stable-dep-of: 442d27ff09a2 ("nfsd: set security label during create operations")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs3proc.c  |  6 ++++--
 fs/nfsd/nfs3xdr.c   |  5 +----
 fs/nfsd/nfs4proc.c  |  3 +--
 fs/nfsd/nfs4state.c |  2 +-
 fs/nfsd/nfsproc.c   |  6 +++---
 fs/nfsd/vfs.c       | 20 +++++++++++++-------
 fs/nfsd/vfs.h       |  2 +-
 fs/nfsd/xdr3.h      |  2 +-
 8 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 666bad8182e5..f4ccbb1f49ba 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -71,13 +71,15 @@ nfsd3_proc_setattr(struct svc_rqst *rqstp)
 	struct nfsd_attrs attrs = {
 		.na_iattr	= &argp->attrs,
 	};
+	const struct timespec64 *guardtime = NULL;
 
 	dprintk("nfsd: SETATTR(3)  %s\n",
 				SVCFH_fmt(&argp->fh));
 
 	fh_copy(&resp->fh, &argp->fh);
-	resp->status = nfsd_setattr(rqstp, &resp->fh, &attrs,
-				    argp->check_guard, argp->guardtime);
+	if (argp->check_guard)
+		guardtime = &argp->guardtime;
+	resp->status = nfsd_setattr(rqstp, &resp->fh, &attrs, guardtime);
 	return rpc_success;
 }
 
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index f32128955ec8..a7a07470c1f8 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -295,17 +295,14 @@ svcxdr_decode_sattr3(struct svc_rqst *rqstp, struct xdr_stream *xdr,
 static bool
 svcxdr_decode_sattrguard3(struct xdr_stream *xdr, struct nfsd3_sattrargs *args)
 {
-	__be32 *p;
 	u32 check;
 
 	if (xdr_stream_decode_bool(xdr, &check) < 0)
 		return false;
 	if (check) {
-		p = xdr_inline_decode(xdr, XDR_UNIT * 2);
-		if (!p)
+		if (!svcxdr_decode_nfstime3(xdr, &args->guardtime))
 			return false;
 		args->check_guard = 1;
-		args->guardtime = be32_to_cpup(p);
 	} else
 		args->check_guard = 0;
 
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 37b918e4a53d..c9ae789bb045 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1160,8 +1160,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 		goto out;
 	save_no_wcc = cstate->current_fh.fh_no_wcc;
 	cstate->current_fh.fh_no_wcc = true;
-	status = nfsd_setattr(rqstp, &cstate->current_fh, &attrs,
-				0, (time64_t)0);
+	status = nfsd_setattr(rqstp, &cstate->current_fh, &attrs, NULL);
 	cstate->current_fh.fh_no_wcc = save_no_wcc;
 	if (!status)
 		status = nfserrno(attrs.na_labelerr);
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 57f1f6aa19c9..511fedc37008 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -5223,7 +5223,7 @@ nfsd4_truncate(struct svc_rqst *rqstp, struct svc_fh *fh,
 		return 0;
 	if (!(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
 		return nfserr_inval;
-	return nfsd_setattr(rqstp, fh, &attrs, 0, (time64_t)0);
+	return nfsd_setattr(rqstp, fh, &attrs, NULL);
 }
 
 static __be32 nfs4_get_vfs_file(struct svc_rqst *rqstp, struct nfs4_file *fp,
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index a7315928a760..36370b957b63 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -103,7 +103,7 @@ nfsd_proc_setattr(struct svc_rqst *rqstp)
 		}
 	}
 
-	resp->status = nfsd_setattr(rqstp, fhp, &attrs, 0, (time64_t)0);
+	resp->status = nfsd_setattr(rqstp, fhp, &attrs, NULL);
 	if (resp->status != nfs_ok)
 		goto out;
 
@@ -390,8 +390,8 @@ nfsd_proc_create(struct svc_rqst *rqstp)
 		 */
 		attr->ia_valid &= ATTR_SIZE;
 		if (attr->ia_valid)
-			resp->status = nfsd_setattr(rqstp, newfhp, &attrs, 0,
-						    (time64_t)0);
+			resp->status = nfsd_setattr(rqstp, newfhp, &attrs,
+						    NULL);
 	}
 
 out_unlock:
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 1faf65147223..51c2ad3847c4 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -459,7 +459,6 @@ static int __nfsd_setattr(struct dentry *dentry, struct iattr *iap)
  * @rqstp: controlling RPC transaction
  * @fhp: filehandle of target
  * @attr: attributes to set
- * @check_guard: set to 1 if guardtime is a valid timestamp
  * @guardtime: do not act if ctime.tv_sec does not match this timestamp
  *
  * This call may adjust the contents of @attr (in particular, this
@@ -471,8 +470,7 @@ static int __nfsd_setattr(struct dentry *dentry, struct iattr *iap)
  */
 __be32
 nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
-	     struct nfsd_attrs *attr,
-	     int check_guard, time64_t guardtime)
+	     struct nfsd_attrs *attr, const struct timespec64 *guardtime)
 {
 	struct dentry	*dentry;
 	struct inode	*inode;
@@ -521,9 +519,6 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
 
 	nfsd_sanitize_attrs(inode, iap);
 
-	if (check_guard && guardtime != inode_get_ctime_sec(inode))
-		return nfserr_notsync;
-
 	/*
 	 * The size case is special, it changes the file in addition to the
 	 * attributes, and file systems don't expect it to be mixed with
@@ -541,6 +536,16 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
 	err = fh_fill_pre_attrs(fhp);
 	if (err)
 		goto out_unlock;
+
+	if (guardtime) {
+		struct timespec64 ctime = inode_get_ctime(inode);
+		if ((u32)guardtime->tv_sec != (u32)ctime.tv_sec ||
+		    guardtime->tv_nsec != ctime.tv_nsec) {
+			err = nfserr_notsync;
+			goto out_fill_attrs;
+		}
+	}
+
 	for (retries = 1;;) {
 		struct iattr attrs;
 
@@ -568,6 +573,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
 		attr->na_aclerr = set_posix_acl(&nop_mnt_idmap,
 						dentry, ACL_TYPE_DEFAULT,
 						attr->na_dpacl);
+out_fill_attrs:
 	fh_fill_post_attrs(fhp);
 out_unlock:
 	inode_unlock(inode);
@@ -1374,7 +1380,7 @@ nfsd_create_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
 	 * if the attributes have not changed.
 	 */
 	if (iap->ia_valid)
-		status = nfsd_setattr(rqstp, resfhp, attrs, 0, (time64_t)0);
+		status = nfsd_setattr(rqstp, resfhp, attrs, NULL);
 	else
 		status = nfserrno(commit_metadata(resfhp));
 
diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h
index e3c29596f4df..b476028e020b 100644
--- a/fs/nfsd/vfs.h
+++ b/fs/nfsd/vfs.h
@@ -69,7 +69,7 @@ __be32		 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *,
 				const char *, unsigned int,
 				struct svc_export **, struct dentry **);
 __be32		nfsd_setattr(struct svc_rqst *, struct svc_fh *,
-				struct nfsd_attrs *, int, time64_t);
+			     struct nfsd_attrs *, const struct timespec64 *);
 int nfsd_mountpoint(struct dentry *, struct svc_export *);
 #ifdef CONFIG_NFSD_V4
 __be32		nfsd4_vfs_fallocate(struct svc_rqst *, struct svc_fh *,
diff --git a/fs/nfsd/xdr3.h b/fs/nfsd/xdr3.h
index 03fe4e21306c..522067b7fd75 100644
--- a/fs/nfsd/xdr3.h
+++ b/fs/nfsd/xdr3.h
@@ -14,7 +14,7 @@ struct nfsd3_sattrargs {
 	struct svc_fh		fh;
 	struct iattr		attrs;
 	int			check_guard;
-	time64_t		guardtime;
+	struct timespec64	guardtime;
 };
 
 struct nfsd3_diropargs {
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6.6.y 3/4] nfsd: set security label during create operations
  2026-01-03 19:38 [PATCH 6.6.y 0/4] NFSD: NFSv4 file creation neglects setting ACL Chuck Lever
  2026-01-03 19:38 ` [PATCH 6.6.y 1/4] nfsd: convert to new timestamp accessors Chuck Lever
  2026-01-03 19:38 ` [PATCH 6.6.y 2/4] nfsd: Fix NFSv3 atomicity bugs in nfsd_setattr() Chuck Lever
@ 2026-01-03 19:38 ` Chuck Lever
  2026-01-03 19:38 ` [PATCH 6.6.y 4/4] NFSD: NFSv4 file creation neglects setting ACL Chuck Lever
  3 siblings, 0 replies; 9+ messages in thread
From: Chuck Lever @ 2026-01-03 19:38 UTC (permalink / raw)
  To: stable
  Cc: linux-nfs, Greg Kroah-Hartman, Sasha Levin, Chuck Lever,
	Jeff Layton, NeilBrown

From: Chuck Lever <chuck.lever@oracle.com>

[ Upstream commit 442d27ff09a218b61020ab56387dbc508ad6bfa6 ]

When security labeling is enabled, the client can pass a file security
label as part of a create operation for the new file, similar to mode
and other attributes. At present, the security label is received by nfsd
and passed down to nfsd_create_setattr(), but nfsd_setattr() is never
called and therefore the label is never set on the new file. This bug
may have been introduced on or around commit d6a97d3f589a ("NFSD:
add security label to struct nfsd_attrs"). Looking at nfsd_setattr()
I am uncertain as to whether the same issue presents for
file ACLs and therefore requires a similar fix for those.

An alternative approach would be to introduce a new LSM hook to set the
"create SID" of the current task prior to the actual file creation, which
would atomically label the new inode at creation time. This would be better
for SELinux and a similar approach has been used previously
(see security_dentry_create_files_as) but perhaps not usable by other LSMs.

Reproducer:
1. Install a Linux distro with SELinux - Fedora is easiest
2. git clone https://github.com/SELinuxProject/selinux-testsuite
3. Install the requisite dependencies per selinux-testsuite/README.md
4. Run something like the following script:
MOUNT=$HOME/selinux-testsuite
sudo systemctl start nfs-server
sudo exportfs -o rw,no_root_squash,security_label localhost:$MOUNT
sudo mkdir -p /mnt/selinux-testsuite
sudo mount -t nfs -o vers=4.2 localhost:$MOUNT /mnt/selinux-testsuite
pushd /mnt/selinux-testsuite/
sudo make -C policy load
pushd tests/filesystem
sudo runcon -t test_filesystem_t ./create_file -f trans_test_file \
        -e test_filesystem_filetranscon_t -v
sudo rm -f trans_test_file
popd
sudo make -C policy unload
popd
sudo umount /mnt/selinux-testsuite
sudo exportfs -u localhost:$MOUNT
sudo rmdir /mnt/selinux-testsuite
sudo systemctl stop nfs-server

Expected output:
<eliding noise from commands run prior to or after the test itself>
Process context:
        unconfined_u:unconfined_r:test_filesystem_t:s0-s0:c0.c1023
Created file: trans_test_file
File context: unconfined_u:object_r:test_filesystem_filetranscon_t:s0
File context is correct

Actual output:
<eliding noise from commands run prior to or after the test itself>
Process context:
        unconfined_u:unconfined_r:test_filesystem_t:s0-s0:c0.c1023
Created file: trans_test_file
File context: system_u:object_r:test_file_t:s0
File context error, expected:
        test_filesystem_filetranscon_t
got:
        test_file_t

Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: NeilBrown <neilb@suse.de>
Stable-dep-of: 913f7cf77bf1 ("NFSD: NFSv4 file creation neglects setting ACL")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/vfs.c | 2 +-
 fs/nfsd/vfs.h | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 51c2ad3847c4..d2ca0739ae81 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1379,7 +1379,7 @@ nfsd_create_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
 	 * Callers expect new file metadata to be committed even
 	 * if the attributes have not changed.
 	 */
-	if (iap->ia_valid)
+	if (nfsd_attrs_valid(attrs))
 		status = nfsd_setattr(rqstp, resfhp, attrs, NULL);
 	else
 		status = nfserrno(commit_metadata(resfhp));
diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h
index b476028e020b..df9baaee052e 100644
--- a/fs/nfsd/vfs.h
+++ b/fs/nfsd/vfs.h
@@ -60,6 +60,14 @@ static inline void nfsd_attrs_free(struct nfsd_attrs *attrs)
 	posix_acl_release(attrs->na_dpacl);
 }
 
+static inline bool nfsd_attrs_valid(struct nfsd_attrs *attrs)
+{
+	struct iattr *iap = attrs->na_iattr;
+
+	return (iap->ia_valid || (attrs->na_seclabel &&
+		attrs->na_seclabel->len));
+}
+
 __be32		nfserrno (int errno);
 int		nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
 		                struct svc_export **expp);
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6.6.y 4/4] NFSD: NFSv4 file creation neglects setting ACL
  2026-01-03 19:38 [PATCH 6.6.y 0/4] NFSD: NFSv4 file creation neglects setting ACL Chuck Lever
                   ` (2 preceding siblings ...)
  2026-01-03 19:38 ` [PATCH 6.6.y 3/4] nfsd: set security label during create operations Chuck Lever
@ 2026-01-03 19:38 ` Chuck Lever
  3 siblings, 0 replies; 9+ messages in thread
From: Chuck Lever @ 2026-01-03 19:38 UTC (permalink / raw)
  To: stable
  Cc: linux-nfs, Greg Kroah-Hartman, Sasha Levin, Chuck Lever,
	Aurélien Couderc, Roland Mainz

From: Chuck Lever <chuck.lever@oracle.com>

[ Upstream commit 913f7cf77bf14c13cfea70e89bcb6d0b22239562 ]

An NFSv4 client that sets an ACL with a named principal during file
creation retrieves the ACL afterwards, and finds that it is only a
default ACL (based on the mode bits) and not the ACL that was
requested during file creation. This violates RFC 8881 section
6.4.1.3: "the ACL attribute is set as given".

The issue occurs in nfsd_create_setattr(), which calls
nfsd_attrs_valid() to determine whether to call nfsd_setattr().
However, nfsd_attrs_valid() checks only for iattr changes and
security labels, but not POSIX ACLs. When only an ACL is present,
the function returns false, nfsd_setattr() is skipped, and the
POSIX ACL is never applied to the inode.

Subsequently, when the client retrieves the ACL, the server finds
no POSIX ACL on the inode and returns one generated from the file's
mode bits rather than returning the originally-specified ACL.

Reported-by: Aurélien Couderc <aurelien.couderc2002@gmail.com>
Fixes: c0cbe70742f4 ("NFSD: add posix ACLs to struct nfsd_attrs")
Cc: Roland Mainz <roland.mainz@nrubsig.org>
Cc: stable@vger.kernel.org
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/vfs.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h
index df9baaee052e..6f059c5ac22b 100644
--- a/fs/nfsd/vfs.h
+++ b/fs/nfsd/vfs.h
@@ -65,7 +65,8 @@ static inline bool nfsd_attrs_valid(struct nfsd_attrs *attrs)
 	struct iattr *iap = attrs->na_iattr;
 
 	return (iap->ia_valid || (attrs->na_seclabel &&
-		attrs->na_seclabel->len));
+		attrs->na_seclabel->len) ||
+		attrs->na_pacl || attrs->na_dpacl);
 }
 
 __be32		nfserrno (int errno);
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 6.6.y 1/4] nfsd: convert to new timestamp accessors
  2026-01-03 19:38 ` [PATCH 6.6.y 1/4] nfsd: convert to new timestamp accessors Chuck Lever
@ 2026-01-08 11:03   ` Greg Kroah-Hartman
  2026-01-08 14:25     ` Chuck Lever
  2026-01-08 12:33   ` Greg Kroah-Hartman
  1 sibling, 1 reply; 9+ messages in thread
From: Greg Kroah-Hartman @ 2026-01-08 11:03 UTC (permalink / raw)
  To: Chuck Lever; +Cc: stable, linux-nfs, Sasha Levin, Chuck Lever

On Sat, Jan 03, 2026 at 02:38:51PM -0500, Chuck Lever wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> [ Upstream commit 335a7be84b526861f3deb4fdd5d5c2a48cf1feef ]

I don't see this git id anywhere in Linus's tree, are you sure it is
correct?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 6.6.y 1/4] nfsd: convert to new timestamp accessors
  2026-01-03 19:38 ` [PATCH 6.6.y 1/4] nfsd: convert to new timestamp accessors Chuck Lever
  2026-01-08 11:03   ` Greg Kroah-Hartman
@ 2026-01-08 12:33   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2026-01-08 12:33 UTC (permalink / raw)
  To: Chuck Lever; +Cc: stable, linux-nfs, Sasha Levin, Chuck Lever

On Sat, Jan 03, 2026 at 02:38:51PM -0500, Chuck Lever wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> [ Upstream commit 335a7be84b526861f3deb4fdd5d5c2a48cf1feef ]
> 
> [ cel: adjust to the 6.6.y version of fs/nfsd/blocklayout.c ]
> Stable-dep-of: 24d92de9186e ("nfsd: Fix NFSv3 atomicity bugs in nfsd_setattr()")
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---

Is this really commit 11fec9b9fb04 ("nfsd: convert to new timestamp
accessors")?  if so, what happened to the original authorship and other
signed-off-by lines?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 6.6.y 1/4] nfsd: convert to new timestamp accessors
  2026-01-08 11:03   ` Greg Kroah-Hartman
@ 2026-01-08 14:25     ` Chuck Lever
  2026-01-08 15:27       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 9+ messages in thread
From: Chuck Lever @ 2026-01-08 14:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: stable, linux-nfs, Sasha Levin, Chuck Lever

On 1/8/26 6:03 AM, Greg Kroah-Hartman wrote:
> On Sat, Jan 03, 2026 at 02:38:51PM -0500, Chuck Lever wrote:
>> From: Chuck Lever <chuck.lever@oracle.com>
>>
>> [ Upstream commit 335a7be84b526861f3deb4fdd5d5c2a48cf1feef ]
> 
> I don't see this git id anywhere in Linus's tree, are you sure it is
> correct?
> 
> thanks,
> 
> greg k-h

If I start from the current upstream master, I find this instead:

commit 11fec9b9fb04fd1b3330a3b91ab9dcfa81ad5ad3
Author:     Jeff Layton <jlayton@kernel.org>
AuthorDate: Wed Oct 4 14:52:37 2023 -0400
Commit:     Christian Brauner <brauner@kernel.org>
CommitDate: Wed Oct 18 14:08:24 2023 +0200

    nfsd: convert to new timestamp accessors

    Convert to using the new inode timestamp accessor functions.

    Signed-off-by: Jeff Layton <jlayton@kernel.org>
    Link:
https://lore.kernel.org/r/20231004185347.80880-50-jlayton@kernel.org
    Signed-off-by: Christian Brauner <brauner@kernel.org>

I picked up 335a7be84b526861f3deb4fdd5d5c2a48cf1feef from an
nfsd-related tag by mistake. Do you want to drop this series and I can
rework it properly?


-- 
Chuck Lever

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 6.6.y 1/4] nfsd: convert to new timestamp accessors
  2026-01-08 14:25     ` Chuck Lever
@ 2026-01-08 15:27       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2026-01-08 15:27 UTC (permalink / raw)
  To: Chuck Lever; +Cc: stable, linux-nfs, Sasha Levin, Chuck Lever

On Thu, Jan 08, 2026 at 09:25:57AM -0500, Chuck Lever wrote:
> On 1/8/26 6:03 AM, Greg Kroah-Hartman wrote:
> > On Sat, Jan 03, 2026 at 02:38:51PM -0500, Chuck Lever wrote:
> >> From: Chuck Lever <chuck.lever@oracle.com>
> >>
> >> [ Upstream commit 335a7be84b526861f3deb4fdd5d5c2a48cf1feef ]
> > 
> > I don't see this git id anywhere in Linus's tree, are you sure it is
> > correct?
> > 
> > thanks,
> > 
> > greg k-h
> 
> If I start from the current upstream master, I find this instead:
> 
> commit 11fec9b9fb04fd1b3330a3b91ab9dcfa81ad5ad3
> Author:     Jeff Layton <jlayton@kernel.org>
> AuthorDate: Wed Oct 4 14:52:37 2023 -0400
> Commit:     Christian Brauner <brauner@kernel.org>
> CommitDate: Wed Oct 18 14:08:24 2023 +0200
> 
>     nfsd: convert to new timestamp accessors
> 
>     Convert to using the new inode timestamp accessor functions.
> 
>     Signed-off-by: Jeff Layton <jlayton@kernel.org>
>     Link:
> https://lore.kernel.org/r/20231004185347.80880-50-jlayton@kernel.org
>     Signed-off-by: Christian Brauner <brauner@kernel.org>
> 
> I picked up 335a7be84b526861f3deb4fdd5d5c2a48cf1feef from an
> nfsd-related tag by mistake. Do you want to drop this series and I can
> rework it properly?

Now dropped, please rework, thanks!

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-01-08 15:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-03 19:38 [PATCH 6.6.y 0/4] NFSD: NFSv4 file creation neglects setting ACL Chuck Lever
2026-01-03 19:38 ` [PATCH 6.6.y 1/4] nfsd: convert to new timestamp accessors Chuck Lever
2026-01-08 11:03   ` Greg Kroah-Hartman
2026-01-08 14:25     ` Chuck Lever
2026-01-08 15:27       ` Greg Kroah-Hartman
2026-01-08 12:33   ` Greg Kroah-Hartman
2026-01-03 19:38 ` [PATCH 6.6.y 2/4] nfsd: Fix NFSv3 atomicity bugs in nfsd_setattr() Chuck Lever
2026-01-03 19:38 ` [PATCH 6.6.y 3/4] nfsd: set security label during create operations Chuck Lever
2026-01-03 19:38 ` [PATCH 6.6.y 4/4] NFSD: NFSv4 file creation neglects setting ACL Chuck Lever

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox