acrn-kernel/fs/nfsd
Jeff Layton 07db1151e0 nfsd: don't hand out delegation on setuid files being opened for write
[ Upstream commit 826b67e637 ]

We had a bug report that xfstest generic/355 was failing on NFSv4.0.
This test sets various combinations of setuid/setgid modes and tests
whether DIO writes will cause them to be stripped.

What I found was that the server did properly strip those bits, but
the client didn't notice because it held a delegation that was not
recalled. The recall didn't occur because the client itself was the
one generating the activity and we avoid recalls in that case.

Clearing setuid bits is an "implicit" activity. The client didn't
specifically request that we do that, so we need the server to issue a
CB_RECALL, or avoid the situation entirely by not issuing a delegation.

The easiest fix here is to simply not give out a delegation if the file
is being opened for write, and the mode has the setuid and/or setgid bit
set. Note that there is a potential race between the mode and lease
being set, so we test for this condition both before and after setting
the lease.

This patch fixes generic/355, generic/683 and generic/684 for me. (Note
that 355 fails only on v4.0, and 683 and 684 require NFSv4.2 to run and
fail).

Reported-by: Boyang Xue <bxue@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-10 09:34:01 +01:00
..
Kconfig
Makefile
acl.h
auth.c
auth.h
blocklayout.c
blocklayoutxdr.c
blocklayoutxdr.h
cache.h
current_stateid.h
export.c
export.h
fault_inject.c
filecache.c nfsd: don't fsync nfsd_files on last close 2023-03-10 09:33:25 +01:00
filecache.h nfsd: fix handling of cached open files in nfsd4_open codepath 2023-01-18 11:58:26 +01:00
flexfilelayout.c
flexfilelayoutxdr.c
flexfilelayoutxdr.h
idmap.h
lockd.c
netns.h
nfs2acl.c NFSD: Finish converting the NFSv2 GETACL result encoder 2022-12-31 13:31:58 +01:00
nfs3acl.c NFSD: Finish converting the NFSv3 GETACL result encoder 2022-12-31 13:31:58 +01:00
nfs3proc.c NFSD: Add an NFSD_FILE_GC flag to enable nfsd_file garbage collection 2023-01-18 11:58:25 +01:00
nfs3xdr.c
nfs4acl.c
nfs4callback.c nfsd: under NFSv4.1, fix double svc_xprt_put on rpc_create failure 2022-12-31 13:32:53 +01:00
nfs4idmap.c
nfs4layouts.c nfsd: fix race to check ls_layouts 2023-03-10 09:33:24 +01:00
nfs4proc.c nfsd: zero out pointers after putting nfsd_files on COPY setup error 2023-03-10 09:34:01 +01:00
nfs4recover.c
nfs4state.c nfsd: don't hand out delegation on setuid files being opened for write 2023-03-10 09:34:01 +01:00
nfs4xdr.c Revert "SUNRPC: Use RMW bitops in single-threaded hot paths" 2023-01-14 10:33:42 +01:00
nfscache.c
nfsctl.c
nfsd.h
nfsfh.c
nfsfh.h
nfsproc.c
nfssvc.c NFSD: copy the whole verifier in nfsd_copy_write_verifier 2023-03-10 09:33:25 +01:00
nfsxdr.c
pnfs.h
state.h
stats.c
stats.h
trace.c
trace.h nfsd: don't fsync nfsd_files on last close 2023-03-10 09:33:25 +01:00
vfs.c use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00
vfs.h NFSD: Pass the target nfsd_file to nfsd_commit() 2023-01-18 11:58:25 +01:00
xdr.h
xdr3.h
xdr4.h NFSD: enhance inter-server copy cleanup 2023-03-10 09:33:24 +01:00
xdr4cb.h