diff options
| author | Chuck Lever <cel@kernel.org> | 2026-07-20 12:37:24 -0400 |
|---|---|---|
| committer | Chuck Lever <cel@kernel.org> | 2026-08-26 16:40:58 -0400 |
| commit | 438293c18f150cae4101467b9fd00221c5fb7e4f (patch) | |
| tree | d902524a4658b7035e137ac65ab09521ddd0aa6b /scripts | |
| parent | f41caf1f53ec2351dd193cec319655beb13cd67f (diff) | |
| download | linux-next-438293c18f150cae4101467b9fd00221c5fb7e4f.tar.gz linux-next-438293c18f150cae4101467b9fd00221c5fb7e4f.zip | |
NFSD: Map flex file layout IDs through the request's user namespace
nfsd4_ff_proc_layoutget() and nfsd4_ff_encode_layoutget() translate
the file's owner and group with init_user_ns, but every other identity
nfsd places on the wire goes through nfsd_user_namespace(). When the
transport carries a credential from a non-initial user namespace, the
flex file layout reports host-global IDs. The client copies those IDs
into the AUTH_SYS credential it presents to the data server, and
svcauth_unix_accept() resolves that credential in the transport's
namespace, so data server I/O runs under an identity unrelated to the
file's owner.
Switching to the request's namespace introduces a second hazard.
from_kuid() returns (uid_t)-1 when the target namespace has no
mapping for the owner, and the IOMODE_READ arm adds one to that
result to derive an identity for which the data server denies
writes. The addition would wrap to zero, handing the client uid 0
instead of an identity distinct from the owner.
Translate both IDs in nfsd4_ff_proc_layoutget(), which has the
svc_rqst, and carry the wire values in struct pnfs_ff_layout.
from_kuid_munged() substitutes overflowuid for an unmapped owner and
thus never returns (uid_t)-1, so the increment cannot wrap to zero.
Fixes: 9b9960a0ca47 ("nfsd: Add a super simple flex file server")
Cc: stable@vger.kernel.org
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260720141442.783935-1-cel@kernel.org?part=3
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Link: https://patch.msgid.link/20260720163724.810227-1-cel@kernel.org
Signed-off-by: Chuck Lever <cel@kernel.org>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions
