public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Benjamin Coddington <bcodding@hammerspace.com>
Cc: Chuck Lever <chuck.lever@oracle.com>, NeilBrown <neil@brown.name>,
	Trond Myklebust <trondmy@kernel.org>,
	Anna Schumaker <anna@kernel.org>,
	Eric Biggers <ebiggers@kernel.org>,
	 Rick Macklem <rick.macklem@gmail.com>,
	linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	 linux-crypto@vger.kernel.org
Subject: Re: [PATCH v2 2/3] NFSD/export: Add sign_fh export option
Date: Thu, 22 Jan 2026 12:03:51 -0500	[thread overview]
Message-ID: <d0439773f714f079f3dfd478a738612986f9e71e.camel@kernel.org> (raw)
In-Reply-To: <B364CDCB-39A6-4C51-A562-CC52CE22C059@hammerspace.com>

On Thu, 2026-01-22 at 11:54 -0500, Benjamin Coddington wrote:
> On 22 Jan 2026, at 11:50, Jeff Layton wrote:
> 
> > On Thu, 2026-01-22 at 11:31 -0500, Benjamin Coddington wrote:
> > > On 22 Jan 2026, at 11:02, Jeff Layton wrote:
> > > 
> > > > On Wed, 2026-01-21 at 15:24 -0500, Benjamin Coddington wrote:
> > > > > In order to signal that filehandles on this export should be signed, add a
> > > > > "sign_fh" export option.  Filehandle signing can help the server defend
> > > > > against certain filehandle guessing attacks.
> > > > > 
> > > > > Setting the "sign_fh" export option sets NFSEXP_SIGN_FH.  In a future patch
> > > > > NFSD uses this signal to append a MAC onto filehandles for that export.
> > > > > 
> > > > > While we're in here, tidy a few stray expflags to more closely align to the
> > > > > export flag order.
> > > > > 
> > > > > Link: https://lore.kernel.org/linux-nfs/cover.1769026777.git.bcodding@hammerspace.com
> > > > > Signed-off-by: Benjamin Coddington <bcodding@hammerspace.com>
> > > > > ---
> > > > >  fs/nfsd/export.c                 | 5 +++--
> > > > >  include/uapi/linux/nfsd/export.h | 4 ++--
> > > > >  2 files changed, 5 insertions(+), 4 deletions(-)
> > > > > 
> > > > > diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
> > > > > index 2a1499f2ad19..19c7a91c5373 100644
> > > > > --- a/fs/nfsd/export.c
> > > > > +++ b/fs/nfsd/export.c
> > > > > @@ -1349,13 +1349,14 @@ static struct flags {
> > > > >  	{ NFSEXP_ASYNC, {"async", "sync"}},
> > > > >  	{ NFSEXP_GATHERED_WRITES, {"wdelay", "no_wdelay"}},
> > > > >  	{ NFSEXP_NOREADDIRPLUS, {"nordirplus", ""}},
> > > > > +	{ NFSEXP_SECURITY_LABEL, {"security_label", ""}},
> > > > > +	{ NFSEXP_SIGN_FH, {"sign_fh", ""}},
> > > > >  	{ NFSEXP_NOHIDE, {"nohide", ""}},
> > > > > -	{ NFSEXP_CROSSMOUNT, {"crossmnt", ""}},
> > > > >  	{ NFSEXP_NOSUBTREECHECK, {"no_subtree_check", ""}},
> > > > >  	{ NFSEXP_NOAUTHNLM, {"insecure_locks", ""}},
> > > > > +	{ NFSEXP_CROSSMOUNT, {"crossmnt", ""}},
> > > > >  	{ NFSEXP_V4ROOT, {"v4root", ""}},
> > > > >  	{ NFSEXP_PNFS, {"pnfs", ""}},
> > > > > -	{ NFSEXP_SECURITY_LABEL, {"security_label", ""}},
> > > > >  	{ 0, {"", ""}}
> > > > >  };
> > > > > 
> > > > > diff --git a/include/uapi/linux/nfsd/export.h b/include/uapi/linux/nfsd/export.h
> > > > > index a73ca3703abb..de647cf166c3 100644
> > > > > --- a/include/uapi/linux/nfsd/export.h
> > > > > +++ b/include/uapi/linux/nfsd/export.h
> > > > > @@ -34,7 +34,7 @@
> > > > >  #define NFSEXP_GATHERED_WRITES	0x0020
> > > > >  #define NFSEXP_NOREADDIRPLUS    0x0040
> > > > >  #define NFSEXP_SECURITY_LABEL	0x0080
> > > > > -/* 0x100 currently unused */
> > > > > +#define NFSEXP_SIGN_FH		0x0100
> > > > >  #define NFSEXP_NOHIDE		0x0200
> > > > >  #define NFSEXP_NOSUBTREECHECK	0x0400
> > > > >  #define	NFSEXP_NOAUTHNLM	0x0800		/* Don't authenticate NLM requests - just trust */
> > > > > @@ -55,7 +55,7 @@
> > > > >  #define NFSEXP_PNFS		0x20000
> > > > > 
> > > > >  /* All flags that we claim to support.  (Note we don't support NOACL.) */
> > > > > -#define NFSEXP_ALLFLAGS		0x3FEFF
> > > > > +#define NFSEXP_ALLFLAGS		0x3FFFF
> > > > > 
> > > > >  /* The flags that may vary depending on security flavor: */
> > > > >  #define NFSEXP_SECINFO_FLAGS	(NFSEXP_READONLY | NFSEXP_ROOTSQUASH \
> > > > 
> > > > One thing that needs to be understood and documented is how things will
> > > > behave when this flag changes. For instance:
> > > > 
> > > > Support we start with sign_fh enabled, and client gets a signed
> > > > filehandle. The server then reboots and the export options change such
> > > > that sign_fh is disabled. What happens when the client tries to present
> > > > that fh to the server? Does it ignore the signature (since sign_fh is
> > > > now disabled), or does it reject the filehandle because it's not
> > > > expecting a signature?
> > > 
> > > That's great question - right now it will first look up the export, see that
> > > NFSEXP_SIGN_FH is not set, then bypass verifying (and truncating) the MAC
> > > from the end of the filehadle before sending the filehandle off to exportfs
> > > - the end result will be will be -ESTALE.
> > > 
> > > Would it be a good idea to allow the server to see that the filehandle has
> > > FH_AT_MAC set, and just trim off the MAC without verifying it?  That would
> > > allow the signed fh to still function on that export.
> > > 
> > > Might need to audit the cases where fh_match() is used in that case, or make
> > > fh_match() signed-aware.  I'm less familiar with those cases, but I can look
> > > into them.
> > > 
> > 
> > No, I think -ESTALE is fine in this situation. I don't think we need to
> > go to any great lengths to make this scenario actually work. We just
> > need to understand what happens if it does, and make sure that it's
> > documented.
> 
> Got it - I will document this behavior in the commit message of the last
> patch on the next posting.  I think I'll probably also add a check for this
> case -- no need to send the filehandle off to the filesystems if we know its
> going to fail to resolve to a dentry.
> 

Consider adding a new section in
Documentation/filesystems/nfs/exporting.rst. Commit messages will be
harder to dig out years from now.
-- 
Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2026-01-22 17:03 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21 20:24 [PATCH v2 0/3] kNFSD Signed Filehandles Benjamin Coddington
2026-01-21 20:24 ` [PATCH v2 1/3] NFSD: Add a key for signing filehandles Benjamin Coddington
2026-01-21 20:43   ` Chuck Lever
2026-01-21 20:54     ` Benjamin Coddington
2026-01-21 22:17       ` Chuck Lever
2026-01-21 22:56         ` Benjamin Coddington
2026-01-21 23:55           ` Chuck Lever
2026-01-22  1:22             ` Benjamin Coddington
2026-01-22 12:30               ` Jeff Layton
2026-01-22 13:28                 ` Benjamin Coddington
2026-01-22 13:50                   ` Jeff Layton
2026-01-22 14:53                 ` Chuck Lever
2026-01-22 14:49               ` Chuck Lever
2026-01-22 15:17                 ` Benjamin Coddington
2026-01-23 23:24                   ` NeilBrown
2026-01-22 12:38           ` Jeff Layton
2026-01-22 18:20             ` Benjamin Coddington
2026-01-22 19:01               ` Chuck Lever
2026-01-22  0:51   ` Eric Biggers
2026-01-22  1:08     ` Benjamin Coddington
2026-01-21 20:24 ` [PATCH v2 2/3] NFSD/export: Add sign_fh export option Benjamin Coddington
2026-01-22 16:02   ` Jeff Layton
2026-01-22 16:31     ` Benjamin Coddington
2026-01-22 16:50       ` Jeff Layton
2026-01-22 16:54         ` Benjamin Coddington
2026-01-22 17:03           ` Jeff Layton [this message]
2026-01-22 18:57         ` Chuck Lever
2026-01-21 20:24 ` [PATCH v2 3/3] NFSD: Sign filehandles Benjamin Coddington
2026-01-23 21:33   ` Chuck Lever
2026-01-23 22:21     ` NeilBrown
2026-01-23 22:28       ` Chuck Lever
2026-01-23 23:38         ` NeilBrown
2026-01-24  0:33           ` Chuck Lever
2026-01-24  1:56             ` NeilBrown
2026-01-24 13:58               ` Benjamin Coddington
2026-01-24 16:07                 ` Chuck Lever
2026-01-24 18:48                   ` Trond Myklebust
2026-01-24 19:48                     ` Chuck Lever
2026-01-26 18:22                       ` Benjamin Coddington
2026-01-28 14:41                         ` Chuck Lever
2026-01-28 21:24                           ` Benjamin Coddington
2026-01-29 14:36                             ` Chuck Lever
2026-01-30 12:58   ` Lionel Cons
2026-01-30 13:25     ` Benjamin Coddington
2026-01-30 14:47       ` Chuck Lever
2026-01-30 23:26         ` Benjamin Coddington
2026-01-30 16:33       ` Trond Myklebust
2026-01-30 14:43     ` Chuck Lever
2026-01-21 22:55 ` [PATCH v2 0/3] kNFSD Signed Filehandles NeilBrown
2026-01-23 22:24 ` [PATCH v2 1/3] NFSD: Add a key for signing filehandles NeilBrown

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=d0439773f714f079f3dfd478a738612986f9e71e.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=anna@kernel.org \
    --cc=bcodding@hammerspace.com \
    --cc=chuck.lever@oracle.com \
    --cc=ebiggers@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=rick.macklem@gmail.com \
    --cc=trondmy@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