From: Jeff Layton <jlayton@kernel.org>
To: Dominik Maier <dmnk@google.com>, Chuck Lever <cel@kernel.org>
Cc: NeilBrown <neil@brown.name>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
linux-nfs@vger.kernel.org, dmnk+artist@google.com
Subject: Re: [PATCH] nfsd: only set NFSD_MAY_BYPASS_GSS for RPC_AUTH_UNIX in nlm_fopen()
Date: Thu, 19 Nov 2026 13:45:15 -0800 [thread overview]
Message-ID: <a36e3bd7fdca210e482f14eb0f0daedd95c074b7.camel@kernel.org> (raw)
In-Reply-To: <20261119192336.2697518-1-dmnk@google.com>
On Thu, 2026-11-19 at 20:23 +0100, Dominik Maier wrote:
> As documented in nlm_fopen(), NFSD_MAY_BYPASS_GSS is intended to let NLM
> clients using AUTH_SYS (RPC_AUTH_UNIX) lock files on Kerberos NFS
> exports, whereas NLM clients using AUTH_NULL (RPC_AUTH_NULL) are only
> meant to bypass authentication when NFSEXP_NOAUTHNLM (no_auth_nlm) is
> enabled via NFSD_MAY_NLM.
>
> However, nlm_fopen() has historically passed NFSD_MAY_BYPASS_GSS
> unconditionally, and check_security_flavor() accepts both RPC_AUTH_UNIX
> and RPC_AUTH_NULL whenever may_bypass_gss is true on an export with a
> pseudoflavor >= RPC_AUTH_DES. Since commit bb4f07f2409c ("nfsd: Fix
> NFSD_MAY_BYPASS_GSS and NFSD_MAY_BYPASS_GSS_ON_ROOT") restricted
> may_bypass_gss to exports with pseudoflavor >= RPC_AUTH_DES, default
> auth_nlm rejects RPC_AUTH_NULL NLM requests on sec=sys exports with
> nfserr_wrongsec while still accepting RPC_AUTH_NULL NLM requests on
> sec=krb5* exports even when no_auth_nlm is not set.
>
> Only set NFSD_MAY_BYPASS_GSS in nlm_fopen() when rq_cred.cr_flavor is
> RPC_AUTH_UNIX so auth_nlm and no_auth_nlm behave consistently across
> sec=sys and GSS exports, requiring no_auth_nlm or an explicit sec=none
> export flavor for RPC_AUTH_NULL NLM requests.
>
> This issue was discovered by an AI-assisted code review tool (ARTIST),
> validated in QEMU against an unmodified v7.4-rc3 kernel without kernel
> modifications or error injection, build-tested with KCFLAGS=-Werror, and
> checked with checkpatch.pl --strict.
>
Sashiko suggests:
Fixes: 4cc9b9f2bf4d ("nfsd: refine and rename NFSD_MAY_LOCK")
> Signed-off-by: Dominik Maier <dmnk@google.com>
> ---
> fs/nfsd/lockd.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/fs/nfsd/lockd.c b/fs/nfsd/lockd.c
> index f24e45d..2683939 100644
> --- a/fs/nfsd/lockd.c
> +++ b/fs/nfsd/lockd.c
> @@ -41,8 +41,8 @@ static int nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f,
> fh.fh_export = NULL;
>
> /*
> - * Allow BYPASS_GSS as some client implementations use AUTH_SYS
> - * for NLM even when GSS is used for NFS.
> + * Allow BYPASS_GSS for AUTH_SYS as some client implementations use
> + * AUTH_SYS for NLM even when GSS is used for NFS.
> * Allow OWNER_OVERRIDE as permission might have been changed
> * after the file was opened.
> * Pass MAY_NLM so that authentication can be completely bypassed
> @@ -50,7 +50,9 @@ static int nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f,
> * for NLM requests.
> */
> access = (flags == O_WRONLY) ? NFSD_MAY_WRITE : NFSD_MAY_READ;
> - access |= NFSD_MAY_NLM | NFSD_MAY_OWNER_OVERRIDE | NFSD_MAY_BYPASS_GSS;
> + access |= NFSD_MAY_NLM | NFSD_MAY_OWNER_OVERRIDE;
> + if (rqstp->rq_cred.cr_flavor == RPC_AUTH_UNIX)
> + access |= NFSD_MAY_BYPASS_GSS;
> nfserr = nfsd_open(rqstp, &fh, S_IFREG, access, filp);
> fh_put(&fh);
>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
prev parent reply other threads:[~2026-11-19 21:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 19:23 [PATCH] nfsd: only set NFSD_MAY_BYPASS_GSS for RPC_AUTH_UNIX in nlm_fopen() Dominik Maier
2026-11-19 21:45 ` Jeff Layton [this message]
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=a36e3bd7fdca210e482f14eb0f0daedd95c074b7.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=cel@kernel.org \
--cc=dmnk+artist@google.com \
--cc=dmnk@google.com \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=tom@talpey.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.