All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Benjamin Coddington <bcodding@hammerspace.com>
Cc: Chuck Lever <cel@kernel.org>,
	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>,
	linux-nfs@vger.kernel.org
Subject: Re: [PATCH v1 0/7] kNFSD Encrypted Filehandles
Date: Tue, 13 Jan 2026 16:42:05 -0800	[thread overview]
Message-ID: <20260114004205.GC2178@quark> (raw)
In-Reply-To: <C79886E5-3064-4202-9813-0D79091F78DF@hammerspace.com>

On Tue, Jan 13, 2026 at 05:33:37PM -0500, Benjamin Coddington wrote:
> > - Individual filehandles are small, on the order of 32- or 64-bytes
> >
> > - But there are a lot of filehandles, perhaps billions, that would
> >   be encrypted or signed by the same key
> >
> > - The filehandle plaintext is predictable
> 
> Mostly, yes.  I think a strength of the AES-CBC implementation is that each
> 16-byte block is hashed with the results of the previous block.  So, by
> starting with the fileid (unique per-file) and then proceeding to the less
> unique block (fsid + fileid again), the total entropy for each encrypted
> filehandle is increased.

This sort of comment shows that the choice of AES-CBC still isn't well
motivated.  AES-CBC is an unauthenticated encryption algorithm that
protects a message's confidentiality.  It isn't a hash function, it
isn't a MAC, and it doesn't protect a message's authenticity.  AES-CBC
will successfully decrypt any ciphertext, even one tampered with by an
attacker, into some plaintext.  You may be confusing AES-CBC with
AES-CBC-MAC.

> > There are plenty of other kmalloc / alloc_page call sites in the
> > request path, and the server is designed around permitting synchronous
> > waits for memory allocated with GFP_KERNEL. If you don't want to wait
> > for memory reclaim, use GFP_NOFS or even GFP_ATOMIC but for such small
> > allocations, it's highly unlikely that an allocation request will fail.
> 
> I'm ok doing the allocation dance for every filehandle, but I think its an
> easy optimization to keep the buffers around if you know you're going to be
> using them - same way we do for RPC buffers.

In the kernel, several MACs (such as HMAC-SHA256, HMAC-SHA512, BLAKE2s,
and SipHash-2-4) have clean APIs that don't require dynamic memory
allocation, scatterlists, or CONFIG_CRYPTO.  If you do need a MAC, you
probably should use one of those algorithms and APIs.

I see that FIPS 140-3 got mentioned.  In the case where the kernel is
certified as a FIPS 140-3 module, I don't know whether this feature
would actually be considered a security function for FIPS purposes or
not.  That would determine whether it would actually be required to use
a FIPS-approved algorithm.  If you're choosing a MAC and want to use a
FIPS-approved one to be safe, you could choose HMAC-SHA256.

However, as I said before, the first thing to do is actually to evaluate
what security guarantees you need.  To me it seems like you want to
ensure that for a given client, only file handles that it was sent by
the server will be accepted by the server (provided that it can't snoop
on handles sent to other clients).  An unauthenticated encryption mode
like AES-CBC doesn't solve that problem.  I think a MAC is sufficient to
solve that problem.  An AEAD would too and would add confidentiality
protection, but that seems overkill / unnecessary here.

- Eric

  reply	other threads:[~2026-01-14  0:42 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-27 17:00 [RFC/v1] kNFSD Encrypted Filehandles Benjamin Coddington
2025-12-27 17:03 ` [PATCH v1 0/2] nfs-utils: encrypted filehandle support Benjamin Coddington
2025-12-27 17:03   ` [PATCH v1 1/2] nfsdctl: Add support for passing encrypted filehandle key Benjamin Coddington
2025-12-27 17:03   ` [PATCH v1 2/2] exportfs: Add support for export option encrypt_fh Benjamin Coddington
2025-12-27 17:04 ` [PATCH v1 0/7] kNFSD Encrypted Filehandles Benjamin Coddington
2025-12-27 17:04   ` [PATCH v1 1/7] nfsd: Convert export flags to use BIT() macro Benjamin Coddington
2025-12-27 17:04   ` [PATCH v1 2/7] nfsd: Add a symmetric-key cipher for encrypted filehandles Benjamin Coddington
2025-12-27 17:04   ` [PATCH v1 3/7] nfsd/sunrpc: add per-thread crypto context pointer Benjamin Coddington
2025-12-27 17:04   ` [PATCH v1 4/7] NFSD: Add a per-knfsd reusable encfh_buf Benjamin Coddington
2025-12-28 17:52     ` kernel test robot
2025-12-29  0:33     ` kernel test robot
2025-12-27 17:04   ` [PATCH v1 5/7] NFSD/export: Add encrypt_fh export option Benjamin Coddington
2025-12-27 17:04   ` [PATCH v1 6/7] NFSD: Add filehandle crypto functions and helpers Benjamin Coddington
2025-12-27 17:14     ` Benjamin Coddington
2025-12-28  1:34     ` Chuck Lever
2025-12-28 20:45       ` Eric Biggers
2025-12-29 13:39         ` Benjamin Coddington
2025-12-28  5:17     ` kernel test robot
2025-12-27 17:04   ` [PATCH v1 7/7] NFSD: Enable filehandle encryption Benjamin Coddington
2025-12-27 23:06   ` [PATCH v1 0/7] kNFSD Encrypted Filehandles NeilBrown
2025-12-27 23:26     ` Benjamin Coddington
2025-12-28  5:49       ` NeilBrown
2025-12-28 17:05         ` Rick Macklem
2025-12-29 12:52           ` Benjamin Coddington
2025-12-28  5:33   ` [PATCH v1 1/7] nfsd: Convert export flags to use BIT() macro NeilBrown
2025-12-29 12:11     ` Benjamin Coddington
2025-12-28 17:09   ` [PATCH v1 0/7] kNFSD Encrypted Filehandles Chuck Lever
2025-12-29 13:23     ` Benjamin Coddington
2026-01-13 11:51       ` Benjamin Coddington
2026-01-13 12:14         ` Jeff Layton
2026-01-13 14:08         ` Chuck Lever
2026-01-13 15:07           ` Benjamin Coddington
2026-01-13 15:18             ` Chuck Lever
2026-01-13 16:05               ` Benjamin Coddington
2026-01-13 16:43                 ` Chuck Lever
2026-01-13 17:02                   ` Benjamin Coddington
2026-01-13 18:53                     ` Chuck Lever
2026-01-13 19:54                       ` Benjamin Coddington
2026-01-13 21:02                         ` Chuck Lever
2026-01-13 22:33                           ` Benjamin Coddington
2026-01-14  0:42                             ` Eric Biggers [this message]
2026-01-14 12:39                               ` Benjamin Coddington
2026-01-14 13:19                                 ` Jeff Layton
2026-01-14 14:19                                   ` Chuck Lever
2026-01-14 14:53                                     ` Trond Myklebust
2026-01-14 15:04                                       ` Chuck Lever
2026-01-14 15:35                                         ` Trond Myklebust

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=20260114004205.GC2178@quark \
    --to=ebiggers@kernel.org \
    --cc=anna@kernel.org \
    --cc=bcodding@hammerspace.com \
    --cc=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --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 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.