Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Martin Belanger <martin.nvme.dev@gmail.com>
Cc: Hannes Reinecke <hare@suse.de>, Hannes Reinecke <hare@kernel.org>,
	Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	Chaitanya Kulkarni <kch@nvidia.com>,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
	keyrings@vger.kernel.org
Subject: Re: [PATCH v6 0/9] nvme-auth: switch to use the kernel keyring
Date: Tue, 24 Nov 2026 21:32:22 +0000	[thread overview]
Message-ID: <20261124213222.GD2227373@google.com> (raw)
In-Reply-To: <851e3fa5-ad88-4470-877f-e977bb1a6ad9@gmail.com>

On Tue, Nov 24, 2026 at 03:50:14PM -0500, Martin Belanger wrote:
> On 11/24/26 15:11, Eric Biggers wrote:
> > Keys not being readable from userspace is one of the usual reasons
> > people think they want to use the keyrings.  The cover letter should say
> > what this series is actually trying to accomplish.  Currently, it only
> > mentions making it so that keys no longer need to be specified on the
> > command line.  But when stated like that, it's a userspace issue: if the
> > nvme program doesn't accept keys on stdin like keyctl does, that's an
> > issue in the nvme program, not the kernel.
> 
> The goal from the user side is that no DH-HMAC-CHAP secret appears on a
> command line, in a connect string or in a configuration file. These end
> up in shell scripts, config files and logs, where unprivileged users can
> read them. With the keyring, the configuration only names the key.
> nvme-keysd (in nvme-cli) imports the secrets into the keyring from
> systemd credentials or from a KMS, and the connection passes only the
> key description.

That is a userspace issue though, unless you also need the key to be
kept out of the /dev/nvme-fabrics connect string or sysfs/configfs show
output.  Note that this patchset also keeps the keyring keys readable by
userspace still.

> > It sounds like the idea is that the kernel would look up the 'struct
> > key' by description again at runtime, such as on reset?  But this series
> > doesn't actually do that.  The lookup just happens once, when the option
> > or sysfs/configfs attribute is written to.  The key is not updatable
> > either, so an external provider that rotates the key has to write to the
> > attribute.  So there's no benefit to keeping the 'struct key' around
> > after that write.
> 
> That is the part that does not work for a key provider. The secret
> behind a key description can change at any time, and the new secret
> must be used at the next authentication. This includes a controller
> that is in a reconnect loop, which can last for a long time.
> 
> v6 looks up the key by description once, when the connect options are
> parsed, and keeps it in opts->dhchap_key for the lifetime of the
> controller. Every reconnect uses that same key. When nvme-keysd
> replaces the key with add_key(), the controller keeps the old secret.
> When the old key is revoked instead, the reconnect fails with -ENOKEY.
> 
> The same happens when an admin changes the secret on the storage
> system. The host must use the new secret at the next reconnect,
> otherwise every reconnect fails until someone writes the new secret to
> the sysfs attribute or connects the controller again.
> 
> Copying the secret into 'struct nvme_dhchap_key' once has the same
> problem. What the provider needs is a lookup by description at each
> authentication, the way NVMe/TCP TLS without a pinned key already
> works: nvme_tcp_alloc_admin_queue() calls nvme_tls_psk_default() at
> each reconnect. That lookup runs in a kernel worker, which has no
> process keyrings, so it also needs a fixed keyring: '.nvme', or the one
> given with the 'keyring' option.

Even if you actually need runtime key rotation without touching
configfs/sysfs (why, when nvme-keysd could just write those files
itself?), this series doesn't actually implement that.

- Eric


  reply	other threads:[~2026-11-24 21:32 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 17:10 [PATCH v6 0/9] nvme-auth: switch to use the kernel keyring Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 1/9] nvme-auth: modify nvme_auth_transform_key() to return status Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 2/9] nvme-keyring: add 'dhchap' key type Hannes Reinecke
2026-11-23 17:31   ` sashiko-bot
2026-11-24  7:39     ` Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 3/9] nvme-auth: switch to use 'struct key' Hannes Reinecke
2026-11-23 17:32   ` sashiko-bot
2026-11-24  7:43     ` Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 4/9] nvme: parse dhchap keys during option parsing Hannes Reinecke
2026-11-23 17:26   ` sashiko-bot
2026-11-24  7:51     ` Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 5/9] nvmet-auth: parse dhchap key from configfs attribute Hannes Reinecke
2026-11-23 17:30   ` sashiko-bot
2026-11-24  7:55     ` Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 6/9] nvme: allow to pass in key description as dhchap secret Hannes Reinecke
2026-11-23 17:32   ` sashiko-bot
2026-11-24  8:31     ` Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 7/9] nvme-auth: wait for authentication to finish when changing keys Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 8/9] nvme-fabrics: allow to pass in keyring by name Hannes Reinecke
2026-11-23 17:30   ` sashiko-bot
2026-11-24  9:21     ` Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 9/9] nvmet: add configfs attribute 'dhchap_keyring' Hannes Reinecke
2026-11-23 17:33   ` sashiko-bot
2026-11-23 21:21 ` [PATCH v6 0/9] nvme-auth: switch to use the kernel keyring Eric Biggers
2026-11-24 10:30   ` Hannes Reinecke
2026-11-24 20:11     ` Eric Biggers
2026-11-24 20:50       ` Martin Belanger
2026-11-24 21:32         ` Eric Biggers [this message]
2026-11-24 22:13           ` Martin Belanger

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=20261124213222.GD2227373@google.com \
    --to=ebiggers@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=hare@kernel.org \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=martin.nvme.dev@gmail.com \
    --cc=sagi@grimberg.me \
    /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