From: Eric Biggers <ebiggers@kernel.org>
To: Benjamin Coddington <bcodding@hammerspace.com>
Cc: Chuck Lever <chuck.lever@oracle.com>,
Jeff Layton <jlayton@kernel.org>, NeilBrown <neil@brown.name>,
Trond Myklebust <trondmy@kernel.org>,
Anna Schumaker <anna@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 v3 3/3] NFSD: Sign filehandles
Date: Mon, 2 Feb 2026 10:19:32 -0800 [thread overview]
Message-ID: <20260202181932.GA2036@quark> (raw)
In-Reply-To: <11253ead28024160aaf8abf5c234de6605cc93b5.1770046529.git.bcodding@hammerspace.com>
On Mon, Feb 02, 2026 at 11:19:38AM -0500, Benjamin Coddington wrote:
> +/*
> + * Append an 8-byte MAC to the filehandle hashed from the server's fh_key:
> + */
> +static int fh_append_mac(struct svc_fh *fhp, struct net *net)
> +{
> + struct nfsd_net *nn = net_generic(net, nfsd_net_id);
> + struct knfsd_fh *fh = &fhp->fh_handle;
> + siphash_key_t *fh_key = nn->fh_key;
> + u64 hash;
> +
> + if (!(fhp->fh_export->ex_flags & NFSEXP_SIGN_FH))
> + return 0;
> +
> + if (!fh_key) {
> + pr_warn_ratelimited("NFSD: unable to sign filehandles, fh_key not set.\n");
> + return -EINVAL;
> + }
> +
> + if (fh->fh_size + sizeof(hash) > fhp->fh_maxsize) {
> + pr_warn_ratelimited("NFSD: unable to sign filehandles, fh_size %d would be greater"
> + " than fh_maxsize %d.\n", (int)(fh->fh_size + sizeof(hash)), fhp->fh_maxsize);
> + return -EINVAL;
> + }
> +
> + hash = siphash(&fh->fh_raw, fh->fh_size, fh_key);
> + memcpy(&fh->fh_raw[fh->fh_size], &hash, sizeof(hash));
> + fh->fh_size += sizeof(hash);
> +
> + return 0;
Note that this is still creating endianness-specific MAC values,
considering that siphash() returns a u64 which is being copied directly
into a byte array. Maybe not what was intended?
- Eric
next prev parent reply other threads:[~2026-02-02 18:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-02 16:19 [PATCH v3 0/3] kNFSD Signed Filehandles Benjamin Coddington
2026-02-02 16:19 ` [PATCH v3 1/3] NFSD: Add a key for signing filehandles Benjamin Coddington
2026-02-02 16:51 ` Benjamin Coddington
2026-02-02 22:31 ` kernel test robot
2026-02-02 16:19 ` [PATCH v3 2/3] NFSD/export: Add sign_fh export option Benjamin Coddington
2026-02-02 16:19 ` [PATCH v3 3/3] NFSD: Sign filehandles Benjamin Coddington
2026-02-02 18:19 ` Eric Biggers [this message]
2026-02-02 18:25 ` Benjamin Coddington
2026-02-03 7:11 ` kernel test robot
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=20260202181932.GA2036@quark \
--to=ebiggers@kernel.org \
--cc=anna@kernel.org \
--cc=bcodding@hammerspace.com \
--cc=chuck.lever@oracle.com \
--cc=jlayton@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