mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: alistair23@gmail.com, chuck.lever@oracle.com, hare@kernel.org,
	kernel-tls-handshake@lists.linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-nvme@lists.infradead.org, linux-nfs@vger.kernel.org
Cc: kbusch@kernel.org, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me,
	kch@nvidia.com, Alistair Francis <alistair.francis@wdc.com>
Subject: Re: [PATCH v4 6/7] nvme-tcp: Allow userspace to trigger a KeyUpdate with debugfs
Date: Mon, 20 Oct 2025 08:33:01 +0200	[thread overview]
Message-ID: <8d6d76b4-6361-4392-9351-bd9d59c96ba0@suse.de> (raw)
In-Reply-To: <20251017042312.1271322-7-alistair.francis@wdc.com>

On 10/17/25 06:23, alistair23@gmail.com wrote:
> From: Alistair Francis <alistair.francis@wdc.com>
> 
> Allow userspace to trigger a KeyUpdate via debugfs. This patch exposes a
> key_update file that can be written to with the queue number to trigger
> a KeyUpdate on that queue.
> 
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
> v4:
>   - No change
> v3:
>   - New patch
> 
>   drivers/nvme/host/tcp.c | 72 +++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 72 insertions(+)
> 
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index 791e0cc91ad8..f5c7b646d002 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -11,6 +11,7 @@
>   #include <linux/crc32.h>
>   #include <linux/nvme-tcp.h>
>   #include <linux/nvme-keyring.h>
> +#include <linux/debugfs.h>
>   #include <net/sock.h>
>   #include <net/tcp.h>
>   #include <net/tls.h>
> @@ -1429,6 +1430,75 @@ static void update_tls_keys(struct nvme_tcp_queue *queue)
>   	}
>   }
>   
> +#ifdef CONFIG_NVME_TCP_TLS
> +#define NVME_DEBUGFS_RW_ATTR(field) \
> +	static int field##_open(struct inode *inode, struct file *file) \
> +	{ return single_open(file, field##_show, inode->i_private); } \
> +	\
> +	static const struct file_operations field##_fops = { \
> +		.open = field##_open, \
> +		.read = seq_read, \
> +		.write = field##_write, \
> +		.release = single_release, \
> +	}
> +
> +static int nvme_ctrl_key_update_show(struct seq_file *m, void *p)
> +{
> +	seq_printf(m, "0\n");
> +
> +	return 0;
> +}
> +
> +static ssize_t nvme_ctrl_key_update_write(struct file *file, const char __user *buf,
> +					  size_t count, loff_t *ppos)
> +{
> +	struct seq_file *m = file->private_data;
> +	struct nvme_ctrl *nctrl = m->private;
> +	struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl);
> +	char kbuf[16] = {0};
> +	int queue_nr, rc;
> +	struct nvme_tcp_queue *queue;
> +
> +	if (count > sizeof(kbuf) - 1)
> +		return -EINVAL;
> +	if (copy_from_user(kbuf, buf, count))
> +		return -EFAULT;
> +	kbuf[count] = 0;
> +
> +	rc = kstrtouint(kbuf, 10, &queue_nr);
> +	if (rc)
> +		return rc;
> +
> +	if (queue_nr >= nctrl->queue_count)
> +		return -EINVAL;
> +
> +	queue = &ctrl->queues[queue_nr];
> +
> +	update_tls_keys(queue);

Are you sure this is correct?

'update_tls_keys' is issuing a handshake request
with 'HANDSHAKE_KEY_UPDATE_TYPE_RECEIVED'.

And the patch introducing it states:
At this time we don't support initiating a KeyUpdate.

So please move this to the patchset implementing support
for initiating KeyUpdates.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich

  parent reply	other threads:[~2025-10-20  6:33 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17  4:23 [PATCH v4 0/7] nvme-tcp: Support receiving KeyUpdate requests alistair23
2025-10-17  4:23 ` [PATCH v4 1/7] net/handshake: Store the key serial number on completion alistair23
2025-10-17 14:37   ` Chuck Lever
2025-10-17  4:23 ` [PATCH v4 2/7] net/handshake: Define handshake_sk_destruct_req alistair23
2025-10-17  4:23 ` [PATCH v4 3/7] net/handshake: Ensure the request is destructed on completion alistair23
2025-10-17  4:23 ` [PATCH v4 4/7] net/handshake: Support KeyUpdate message types alistair23
2025-10-20  6:09   ` Hannes Reinecke
2025-10-21  3:19     ` Alistair Francis
2025-10-22  4:40       ` Alistair Francis
2025-10-22  7:03         ` Hannes Reinecke
2025-10-22 23:47           ` Alistair Francis
2025-10-17  4:23 ` [PATCH v4 5/7] nvme-tcp: Support KeyUpdate alistair23
2025-10-17  4:29   ` Christoph Hellwig
2025-10-20  6:22   ` Hannes Reinecke
2025-10-22  4:35     ` Alistair Francis
2025-10-22  6:56       ` Hannes Reinecke
2025-10-22 11:16         ` Alistair Francis
2025-10-17  4:23 ` [PATCH v4 6/7] nvme-tcp: Allow userspace to trigger a KeyUpdate with debugfs alistair23
2025-10-17  4:31   ` Christoph Hellwig
2025-10-20  6:33   ` Hannes Reinecke [this message]
2025-10-17  4:23 ` [PATCH v4 7/7] nvmet-tcp: Support KeyUpdate alistair23
2025-10-20  6:26   ` Hannes Reinecke
2025-10-20 17:46 ` [PATCH v4 0/7] nvme-tcp: Support receiving KeyUpdate requests Hannes Reinecke
2025-10-21  1:01   ` Alistair Francis
2025-10-21  6:40     ` Hannes Reinecke
2025-10-22  4:39       ` Alistair Francis

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=8d6d76b4-6361-4392-9351-bd9d59c96ba0@suse.de \
    --to=hare@suse.de \
    --cc=alistair.francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=chuck.lever@oracle.com \
    --cc=hare@kernel.org \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=kernel-tls-handshake@lists.linux.dev \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=netdev@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®