mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Chuck Lever <cel@kernel.org>,
	Martin Belanger <martin.nvme.dev@gmail.com>,
	Sabrina Dubroca <sd@queasysnail.net>
Cc: John Fastabend <john.fastabend@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Shuah Khan <shuah@kernel.org>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org,
	Hannes Reinecke <hare@kernel.org>,
	kernel-tls-handshake@lists.linux.dev,
	linux-nvme@lists.infradead.org,
	Alistair Francis <alistair.francis@wdc.com>,
	Martin Belanger <martin.belanger@dell.com>,
	Daniel Pereira <danielmaraboo@gmail.com>
Subject: Re: [PATCH net-next v6 0/6] tls: perform TLS 1.3 KeyUpdate in the kernel
Date: Thu, 3 Dec 2026 10:34:14 +0100	[thread overview]
Message-ID: <a4a9942a-4e3a-4690-8edf-3dc3b95794a4@suse.de> (raw)
In-Reply-To: <9afa5b2f-e3b4-42cc-9486-605547d8f0d9@app.fastmail.com>

On 12/2/26 7:51 PM, Chuck Lever wrote:
> 
> 
> On Wed, Dec 2, 2026, at 10:37 AM, Martin Belanger wrote:
>> Hi Sabrina,
>>
>> Welcome back, and thank you for the review.
>>
>>
>> On 12/1/26 07:31, Sabrina Dubroca wrote:
>>> I think almost all of it could be in net/handshake.
>>
>> I agree. Here is a proposal along that line. I would like your view
>> before I post patches.
>>
>>> Stealing handshake messages under a full TLS implementation's feet
>>> doesn't seem right.
>>
>> No new socket options. TLS_TX_TRAFFIC_SECRET, TLS_RX_TRAFFIC_SECRET
>> and TLS_TX_KEY_UPDATE go away. User space cannot give secrets to kTLS,
>> so kTLS never takes KeyUpdate away from a TLS library. Libraries keep
>> the rekey support you added.
>>
>> This is less than v6 offered. Only kernel consumers (nvme-tcp,
>> nvmet-tcp, sunrpc) get KeyUpdate in the kernel. User-space TLS
>> libraries such as GnuTLS and OpenSSL get nothing new from this. They
>> keep doing KeyUpdate themselves, as today.
>>
>> KeyUpdate moves to net/handshake. tlshd passes the traffic secrets in
>> the DONE command. net/handshake keeps them and does all the TLS 1.3
>> parts: HKDF-Expand-Label, the KeyUpdate message, the update_requested
>> state, and the choice of the record limit. The consumers (nvme-tcp,
>> nvmet-tcp, sunrpc) do not change.
>>
>> kTLS gives three record layer services to net/handshake.
>> net/handshake registers for them on the socket when the handshake
>> completes:
>>
>> 1. kTLS shows each received handshake record to net/handshake.
>>     net/handshake consumes a KeyUpdate. Any other handshake message
>>     goes to the consumer as today.
>> 2. Before the next data record, kTLS sends a KeyUpdate from
>>     net/handshake, with the current key. kTLS does this when a reply is
>>     pending (net/handshake set this flag when it processed the received
>>     KeyUpdate) or when rec_seq reaches a limit that net/handshake set.
>>     Both are plain checks in kTLS: there is no call into net/handshake
>>     for each record.
>> 3. At a record boundary, kTLS installs the next key that net/handshake
>>     derives, through tls_set_sw_offload(), the same path as your
>>     rekey. The sequence number restarts at 0.
>>
>> kTLS has no secrets, no HKDF and no KeyUpdate logic. As in v6, this is
>> for the software path only.
> 
> Do you have a long-term plan for KeyUpdate for hardware offload?
> That's where we expect to win back some performance for NVMe and
> NFS when using full encryption. (I realize that kTLS's TLSv1.3
> implementation does not yet support hardware offload).
> 
Well, I'm less concerned with that. On my testbed TLS _software_
encryption takes up only a few percents of the performance, so
not really something to get worked on about.

And TLS offloading tends to be a tricky thing (note the competing
proposals from Mellanox/NVidia to do _either_ TLS offload _or_ NVMe 
offload ...), so I wouldn't hold my breath.

Plus the missing support for TLSv1.3 speaks for itself...

> 
>> I have a working prototype. kTLS gets about 210 lines of code, instead
>> of about 400 in v6. net/handshake gets about 230. I tested NVMe/TCP
>> host and target with AES-128-GCM and AES-256-GCM, with and without
>> update_requested, and with a KeyUpdate every 20000 records to make
>> them frequent. The data read back matched the data written.
>>
>> Testing: the v6 selftests register the secrets from user space. That
>> is not possible without the socket options. I plan KUnit tests in
>> net/handshake, which already has KUnit tests. I have not checked yet
>> how well KUnit can drive a kTLS socket pair. If you prefer another
>> way, please tell me.
>>
>>> If we end up going further with this approach, please CC some crypto
>>> folks on at least the first patch
>>
>> I will Cc the lib/crypto maintainers and Herbert Xu.
>>
>> Chuck, this adds attributes to the DONE command and per-socket state
>> to net/handshake. Is that acceptable for you?
> 
> Not adding new socket options IMO is helpful, as that kind of kABI
> change can be difficult to coordinate.
> 
> The netlink handshake protocol is fairly flexible about the addition
> of new attributes. The only concern is about dealing with mismatched
> tlshd and kernel versions with regard to KeyUpdate support. That
> typically involves just a little bit of extra complexity to sort.
> 
But nothing insurmountable. We'll have to code a compat layer anyway,
which, I'm sure, Claude is happy to do :-)

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:[~2026-12-03  9:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 16:30 Martin Belanger via B4 Relay
2026-11-05 16:30 ` [PATCH net-next v6 1/6] tls: add HKDF-Expand-Label for the TLS 1.3 key schedule Martin Belanger via B4 Relay
2026-11-05 16:30 ` [PATCH net-next v6 2/6] tls: add socket options to register the traffic secrets Martin Belanger via B4 Relay
2026-11-05 16:30 ` [PATCH net-next v6 3/6] tls: loop in tls_sw_splice_read() until it has a record Martin Belanger via B4 Relay
2026-11-05 16:30 ` [PATCH net-next v6 4/6] tls: update the RX key when a KeyUpdate is received Martin Belanger via B4 Relay
2026-11-09 17:18   ` netdev-bot+sashiko
2026-11-10 16:49     ` Martin Belanger
2026-11-05 16:30 ` [PATCH net-next v6 5/6] tls: send a KeyUpdate at the record limit and on request Martin Belanger via B4 Relay
2026-11-09 17:18   ` netdev-bot+sashiko
2026-11-10 16:55     ` Martin Belanger
2026-11-05 16:30 ` [PATCH net-next v6 6/6] selftests/tls: add KeyUpdate tests Martin Belanger via B4 Relay
2026-11-09 17:18   ` netdev-bot+sashiko
2026-11-10 16:59     ` Martin Belanger
2026-11-06 21:40 ` [PATCH net-next v6 0/6] tls: perform TLS 1.3 KeyUpdate in the kernel Sabrina Dubroca
2026-11-09 12:14   ` Martin Belanger
2026-12-01 11:48     ` Martin Belanger
2026-12-01 12:31     ` Sabrina Dubroca
2026-12-01 13:27       ` Hannes Reinecke
2026-12-02 15:37       ` Martin Belanger
2026-12-02 18:51         ` Chuck Lever
2026-12-02 19:12           ` Martin Belanger
2026-12-03  9:34           ` Hannes Reinecke [this message]

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=a4a9942a-4e3a-4690-8edf-3dc3b95794a4@suse.de \
    --to=hare@suse.de \
    --cc=alistair.francis@wdc.com \
    --cc=cel@kernel.org \
    --cc=corbet@lwn.net \
    --cc=danielmaraboo@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hare@kernel.org \
    --cc=horms@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kernel-tls-handshake@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=martin.belanger@dell.com \
    --cc=martin.nvme.dev@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=sd@queasysnail.net \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.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

all inboxes | Powered by JetHome®