From: Chuck Lever <cel@kernel.org>
To: Christian Brauner <brauner@kernel.org>
Cc: <linux-fsdevel@vger.kernel.org>,
Chuck Lever <chuck.lever@oracle.com>,
sashiko-bot <sashiko-bot@kernel.org>
Subject: [PATCH 5/7] nfsd: Use kernel credentials for case-info probe
Date: Fri, 15 May 2026 11:35:13 -0400 [thread overview]
Message-ID: <20260515153515.362266-6-cel@kernel.org> (raw)
In-Reply-To: <20260515153515.362266-1-cel@kernel.org>
From: Chuck Lever <chuck.lever@oracle.com>
nfsd_get_case_info() takes prepare_creds() and overrides fsuid/fsgid
to GLOBAL_ROOT, intending to escape per-client policy on the parent
directory. prepare_creds() copies the calling task's full credential,
including the LSM security label, so only the DAC identity is
neutralized. With labeled NFS, where the active LSM context has been
mapped to the client, security_inode_file_getattr() can still deny the
probe with -EACCES even though the case-folding property the caller
wants is structural and identical for every client. The docblock
already states the intent ("the probe runs with kernel credentials"),
which the implementation does not deliver.
prepare_kernel_cred(&init_task) constructs a credential from
init_task's identity and security label, the kernel's own unconfined
context. Use it instead and drop the redundant fsuid/fsgid overrides
that init_task already supplies. The probe now matches the docblock,
LSM denials on the parent disappear, and the call sites that map an
unexpected error to NFS3ERR_SERVERFAULT or fail an NFSv4 GETATTR
outright stop seeing -EACCES from this path.
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260507-case-sensitivity-v14-0-e62cc8200435@oracle.com?part=14
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/nfsd/vfs.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 85ff418127c7..ba97e287c007 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -2943,13 +2943,11 @@ nfsd_get_case_info(struct dentry *dentry, bool *case_insensitive,
put = true;
}
- probe = prepare_creds();
+ probe = prepare_kernel_cred(&init_task);
if (!probe) {
err = -ENOMEM;
goto out;
}
- probe->fsuid = GLOBAL_ROOT_UID;
- probe->fsgid = GLOBAL_ROOT_GID;
saved = override_creds(probe);
err = vfs_fileattr_get(cd, &fa);
--
2.54.0
next prev parent reply other threads:[~2026-05-15 15:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 15:35 [PATCH 0/7] Fixes for vfs/vfs-7.2.casefold Chuck Lever
2026-05-15 15:35 ` [PATCH 1/7] tools headers UAPI: Sync case-sensitivity flags from linux/fs.h Chuck Lever
2026-05-15 15:35 ` [PATCH 2/7] nfs: Avoid transient zeroed case capability bits during probe Chuck Lever
2026-05-15 15:35 ` [PATCH 3/7] nfs: Skip pathconf probe when neither field is consumed Chuck Lever
2026-05-15 15:35 ` [PATCH 4/7] fs: Clarify FS_CASEFOLD_FL semantics in UAPI header Chuck Lever
2026-05-15 15:35 ` Chuck Lever [this message]
2026-05-15 15:35 ` [PATCH 6/7] nfsd: Map -ESTALE from case probe to NFS3ERR_STALE Chuck Lever
2026-05-15 15:35 ` [PATCH 7/7] nfsd: Cap case-folding probe cost across READDIR entries Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260515153515.362266-6-cel@kernel.org \
--to=cel@kernel.org \
--cc=brauner@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=sashiko-bot@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox