From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796290458; b=bgUI8BM3qXIuZWXc3Gaet89sSZJdz+tZacULg/2kw9hHMooDb6HnhStOUaQU7UJ6QBZh liW8LSdjGS0xWCEyyiw2hgQqKRB5OggFmARbTYvsN07jBwe8Mn1mLkKzmxhR2zPtVaRYc 9EAyLHIEHB7yppA8+d5GCw1GjIrvtkCN2pL+FcvZcacUaxV/1C1zUwweF1pRdxJCrKdiM +MIYkNkEBo9pFu/Pc2ZeNAZupB6VwPx8AonbTBBwrdMI6nowYIDQsjFU0XicyO+k7OPeA /Xdprg3eBfwQYPjfXMLfiZUT7ruS+dMdv0z1zinwVrzNH9nILcg2QgPaXikhgKJ9dcA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796290458; h=DMARC-Filter:Received:DKIM-Signature:DKIM-Signature:DKIM-Signature: DKIM-Signature:Received:Received:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-Spamd-Result:X-Rspamd-Server: X-Rspamd-Action:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Rspamd-Queue-Id; bh=qRRKMAQAK7PnqWdRoXtwp7MTnA0FwwCPiXQ4BHqi/p8=; b=HiykdaQ56ttKjFrZL5J76jUDHAaYBFOacs2E/tQT9LPh6LX9PHBANLPkyJGO+fMvIA5b BkubbhVV7Bg6bNEIDyH4gmwq25RpkHsi5AATASnaf+qsJmGv+wrKllo5Kh1h/r56wfdim WkpMVXKpYSGmz+HagZUWnjCZB5yNACY1ZA7QpqUaMHYQrHcPyb4yFbUCPPKzB/z1dJIsd /3Iv8IR3Y3o4kOiDrK5pJ5JHP3IVuk2lAPhzgJEfxCLmN5GkRbWuBnuo5Ba/C+mQSOm9z mElI8nEjJ6JY8RnuE6jFIp0gVJ6XcVXwi1Y9MAo6Ud9Mn10VcSP4lcPrm3jJ21tcn/A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=El4x2hS7; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=zqeYZf4k; dkim=pass header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=El4x2hS7; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=zqeYZf4k; arc=none smtp.remote-ip=195.135.223.130 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F347606A333; Thu, 3 Dec 2026 09:34:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8F347606A333 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=El4x2hS7; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=zqeYZf4k; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=El4x2hS7; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=zqeYZf4k Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6AF4F33ECD; Thu, 3 Dec 2026 09:34:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1796290455; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qRRKMAQAK7PnqWdRoXtwp7MTnA0FwwCPiXQ4BHqi/p8=; b=El4x2hS7b5M8aZ3mxEvnClF8l5NPayk6zpTVg3TYPTBbGqHYKQiRmZvuT5QL3Kkj7E0YIt qPxKBXjszC0tom59e5GG/BfwgGhDhWlfhEMelHfNiCEgu4D2uVWFfonyx+w36BKFVl3O66 lWAF1uYlD3ht4N5t7uzbF5mQVM2LDZg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1796290455; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qRRKMAQAK7PnqWdRoXtwp7MTnA0FwwCPiXQ4BHqi/p8=; b=zqeYZf4kDjj1kLDE1XAkbwKL2ZXETIoKuIZbAgm3BFNz9deIEJAEqSaha1DLS46tBvoMDj 6Frx2xCMhomGVrAg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=El4x2hS7; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=zqeYZf4k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1796290455; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qRRKMAQAK7PnqWdRoXtwp7MTnA0FwwCPiXQ4BHqi/p8=; b=El4x2hS7b5M8aZ3mxEvnClF8l5NPayk6zpTVg3TYPTBbGqHYKQiRmZvuT5QL3Kkj7E0YIt qPxKBXjszC0tom59e5GG/BfwgGhDhWlfhEMelHfNiCEgu4D2uVWFfonyx+w36BKFVl3O66 lWAF1uYlD3ht4N5t7uzbF5mQVM2LDZg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1796290455; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qRRKMAQAK7PnqWdRoXtwp7MTnA0FwwCPiXQ4BHqi/p8=; b=zqeYZf4kDjj1kLDE1XAkbwKL2ZXETIoKuIZbAgm3BFNz9deIEJAEqSaha1DLS46tBvoMDj 6Frx2xCMhomGVrAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E6E501348F; Thu, 3 Dec 2026 09:34:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id glCEL5Y3EWsgZgAAD6G6ig (envelope-from ); Thu, 03 Dec 2026 09:34:14 +0000 Message-ID: Date: Thu, 3 Dec 2026 10:34:14 +0100 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v6 0/6] tls: perform TLS 1.3 KeyUpdate in the kernel To: Chuck Lever , Martin Belanger , Sabrina Dubroca Cc: John Fastabend , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Jonathan Corbet , Shuah Khan , Randy Dunlap , Shuah Khan , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Hannes Reinecke , kernel-tls-handshake@lists.linux.dev, linux-nvme@lists.infradead.org, Alistair Francis , Martin Belanger , Daniel Pereira References: <20261105-keyupdate-rfc-v6-0-99b695f9eb4f@gmail.com> <7f9b7ab9-9728-42be-a5c1-9e8e62c23ab9@gmail.com> <9afa5b2f-e3b4-42cc-9486-605547d8f0d9@app.fastmail.com> Content-Language: en-US From: Hannes Reinecke In-Reply-To: <9afa5b2f-e3b4-42cc-9486-605547d8f0d9@app.fastmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-12.00 / 50.00]; SUSE_INTERNAL_BYPASS(-9.00)[]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; XM_UA_NO_VERSION(0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; ARC_NA(0.00)[]; FREEMAIL_TO(0.00)[kernel.org,gmail.com,queasysnail.net]; RCPT_COUNT_TWELVE(0.00)[23]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; MID_RHS_MATCH_FROM(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[gmail.com,kernel.org,davemloft.net,redhat.com,lwn.net,linuxfoundation.org,infradead.org,vger.kernel.org,lists.linux.dev,lists.infradead.org,wdc.com,dell.com]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; TAGGED_RCPT(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:dkim] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Flag: NO X-Spam-Score: -12.00 X-Spam-Level: X-Rspamd-Queue-Id: 6AF4F33ECD 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