🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #11379

Re: [PATCH net-next v5 5/6] tls: send a KeyUpdate at the record limit and on request

#11379
From: Martin Belanger
Date: Wed, 04 Nov 2026 23:35
42 lines
13226 bytes

On 11/4/26 16:43, sashiko-bot@kernel.org wrote:
 > > +   ret = tls_encrypt_async_wait(ctx);
 > > +   if (!ret)
 > > +           ret = tls_keyupdate_rekey(sk, 1);
 >
 > [Severity: Medium]
 > As reported by Sashiko on v4 [1], can tls_tx_key_update() ignore fatal
 > transmission errors and rotate the TX key anyway when 
tls_tx_records() fails
 > with -EPIPE or -ECONNRESET?

Yes, but this is not specific to KeyUpdate. After shutdown(SHUT_WR),
send() on a kTLS socket with no KeyUpdate also returns the full
length. I tested this with TLS 1.3 AES-GCM. As I read the code, the
KeyUpdate record then stays queued and TCP does not send it, so the
peer never sees a record with the next key.

This corrects my note in the v2 changes, "The next call reports the
error". In the same test, the next send() also returned success.

 > [Severity: High]
 > As reported by Sashiko on v4 [2], how is the KeyUpdate state in struct
 > tls_context synchronized when sk_stream_wait_memory() drops lock_sock(sk)
 > during a send or TLS_TX_KEY_UPDATE?

No change, for the reasons in the v4 changes. I checked these points
by reading the code.

Points 1 and 2 need a TLS_TX or TLS_RX setsockopt() during a blocked
sendmsg(), which is an application error.

Point 3: tx_key_update_reply stays set after the update_requested
KeyUpdate, so the reply still goes out before the next Application
Data record.

Point 4: a record that was already being written can go out before
the reply. RFC 9846 section 4.7.3 allows this for records in flight.

Martin
Technical Details
Message-ID: <2a1728c5-2856-41bb-9ffd-c80df4ffda6e@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356993-linux-kernel-netdev=dewy.ru
References: <20261103-keyupdate-rfc-v5-0-de1ab90a88d5@gmail.com> <20261103-keyupdate-rfc-v5-5-de1ab90a88d5@gmail.com> <sashiko-outbox-198141@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356993-linux-kernel-netdev=dewy.ru
From: martin.nvme.dev@gmail.com (Martin Belanger)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v5 5/6] tls: send a KeyUpdate at the record limit
 and on request
Date: Wed, 4 Nov 2026 18:35:54 -0500
Organization: Usenet Network
Message-ID: <2a1728c5-2856-41bb-9ffd-c80df4ffda6e@gmail.com>
References: <20261103-keyupdate-rfc-v5-0-de1ab90a88d5@gmail.com>
 <20261103-keyupdate-rfc-v5-5-de1ab90a88d5@gmail.com>
 <sashiko-outbox-198141@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="3520223"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:UP/JJbXPeuM6tw2RMomrPoM/Cnc= sha256:2ojDvKjJCSUN2xkM8Ysz7LAelHDxktkMiZIUI887jCU=
	sha1:HMtLvsfYgVAExx2xWqXaZ/ngib8= sha256:0qon0lDvPwAAhwKhzrbfCTU3Cc26JbSJYjYOjDYD308=
Content-Language: en-US
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 82336112E02; Thu,  5 Nov 2026 02:58:48 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id dyPVAbLA5SS1;
	Thu,  5 Nov 2026 02:58:45 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-356993-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id A54EE112DE6; Thu,  5 Nov 2026 02:58:36 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 67216614582; Wed,  4 Nov 2026 23:36:11 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793835365;
	b=uEAX+KaSFxqkRA8jBkgJk6DlC2AO1cky9KXaFS4GWFuooFN6ZxWLOjpG0hBf5HgzsFL+
	 OlNoFIR0V6Ru833qDDBcIqvoeOpg8ca6tuLlvr5PXbcsjxUjtvgyX7AhhZ6Kh/JwR7Y07
	 YCyW9BNO/tZZggPwKutT82Dn1AvQYxcGEIRSGcP8lquqYuk2mBxXvcjQX3+nd8cLXhMvw
	 MOjVQZZ5N8bXDMWuJ76/TeDY2OZtXQw6Tjrk+ubGHGVQCwXx+cOindES4B95TxqF3gb5O
	 NZG+oCj1BAYlTKui/fwouVFP1r7WxfoHxMHVQrU6QiImmhyi97hs4SF3MtcWhyqAWTw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793835365;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:Message-ID:Date:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:User-Agent:Subject:To:Cc:References:
	 Content-Language:From:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding;
	bh=dmn1Q3/145xsrJD3bHMxFjskCeqjVe350pnKBSHlWz0=;
	b=Nzu9XrSpCJ7k3vcrsVbbyogXYoxWVcUwYajTVHdHDVOkAaqcZwNsynMgM6MKw55jbWkv
	 rPCd7xEHoez7SLVSXpis9CcwCT78wILPj8KfBrH4n4WN6J/i6CDV552M30uKx/wJ7Icg0
	 6VX09FfdHcSc42bzxscxA43CGIcE1FiGZCxFC5ijPlVhbdIpia7m0N6RIMIonFbVfZU7T
	 29xHjHCK103GBDXFUXqXxGo0WIGG2n4+VHq2iKw2x7SdWjwu7wxbf/0Us/58eVqsohnq+
	 KS3eOSXx9COYQVW9lgenjj7do9Mp3Yga6ny99MCTgBT5mdWRnAGzGwyk3lZ5JClI4DQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=SJMJgTdc;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BDA2606A33F;
	Wed,  4 Nov 2026 23:36:05 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=SJMJgTdc
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.230.193
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793835358;
	b=Y05aDYUR7f7/K5cmxNnkSwAj40FA1YwuR8Jaoe5gXNjIJMM+qWcYjBYbmhf+6eDtk11p
	 SVKXVdgMFmLbt9kev8of1NdBA27hZ39xAMT/MFuBMpzHBVTqC6N1E/llscKRrVvuYtRc8
	 ImvTWI0qvAix3/CThlICDuOokLmRookC+Bp3v5GYvmhPxY9j+uJdSDHyoO5qbCB3k2Jiv
	 mY9Aoycnx6ze68x/W+JCarDnCClcfUxN2SwcWAfQkqCAfzlc1xiSI1Bx/9JzUvBEjbsVk
	 dl54dbM/BQyd9ILrCQOPA5Sfr0FhgQzAXQzFmyC0dYxQzj0LjCLYgwDEv0yLrskgKYA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793835358;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:
	 Content-Language:From:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding;
	bh=dmn1Q3/145xsrJD3bHMxFjskCeqjVe350pnKBSHlWz0=;
	b=vUE1Ho5GTBx/UNyI0n3OkWwwaVEWEjFOxxAzY194iRtp+dL0Kuh4YVQEKZ9jy4x5riQH
	 aQauNPqP1GjW7L4gDtgTELNd9C3Dah/ZYEL3+gx+q3Jo58bBCb0ktQPKx0c0jfjlWaPW3
	 aAjG1GCtDop8pl17CkTIilhjLTTKcZuasNjNnmLXT4KScd5taYANsmP0fP8cQ/xz4an2e
	 3aSNnTCIbJXj3WzkdiAVd+dDuUqL+JED+KIDfHeoHuIcxostD4//qc4sK2+FL2Kzi6w/q
	 WauvlJTRRKzTEttaXN4MChSY0NZ/8HgX4mveHkHrcq211QM5Ujg4v7OZrf2PaIvYXGw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=SJMJgTdc;
	arc=none smtp.remote-ip=74.125.230.193
X-Received: from mail-qk2-f1.google.com (mail-qk2-f1.google.com [74.125.230.193])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84662606A329
	for <netdev@vger.kernel.org>; Wed,  4 Nov 2026 23:35:57 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 84662606A329
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-qk2-f1.google.com with SMTP id d75a77b69052e-5332a0f6dbbso8351641cf.1
        for <netdev@vger.kernel.org>; Wed, 04 Nov 2026 15:35:57 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793835356; x=1794440156; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=dmn1Q3/145xsrJD3bHMxFjskCeqjVe350pnKBSHlWz0=;
        b=SJMJgTdcGBlQsf4zsbrbO1j5AkB7ELH4/WVaj4Sdyja5e8Qsu41MqKvyxQgJjRsmvv
         WB2WEmuLJYf6rFz6iWK8B8a0Qq8ltXqfC3dLLnzSb/Vr1kzCqcVcDQZ3cIfBHOZ+5v5F
         BLE6BusncD13AnA+suHKkbOfoVPCAwy7EG8dZrxWIbo07psQ3pnSg+ksINDz1A9UUWrH
         6Dd8sem9Gf8LjO7S5z/9LOgyh3nnxfHBf53t/4egxxRnpdKvyogEIV7ou2TArLsJ0HCF
         m+eLHxQj4QlJJHgWrpJlhhc2fC9xqCmbyf3EoxeRtwyCaKY2DnrxE2PcuGUmjyMKs6Rf
         jPYA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793835356; x=1794440156;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=dmn1Q3/145xsrJD3bHMxFjskCeqjVe350pnKBSHlWz0=;
        b=NWNqnU/P31TxfZ2LPiNQLoB3pW5OhBu2Es6kcNFrW8E7cc0PfHe3SI8Au8TeIuRoS8
         UybuEffua30y4xbQaSWvVIwDxjEU0m59BAjzt1EUOhOgjt5iIrMVmvrZGo5ZbjbhVo1V
         zoHz8THoorUIb+9a7GXEaJra1xGj/Wi+uUejKsD8QU9AE0W9tPd8ac6/b3Qu/esjhcIj
         nmAqwfVGpAiGJ/g5U1jECOLJVrMdG0gIMQspl2P7TjSOYOqEF56XGYGKEGfhKn5zw3MK
         K5xDTqQWuAAkOtnN8nWZsNvlSEo/U/qnCE8ehYsOY3RVX1r62PXwBthBhmClMXBIHHqi
         aHzw==
X-Forwarded-Encrypted: i=1; AKwUvBzPyN/GAeXZydNJk85bBG/P16Nyydfto2Lj/fRsQC3WIg0g/VsheciIQFwU25VDUPpUy0PlcSg=@vger.kernel.org
X-Gm-Message-State: APuU4Z8cJwyXRL6bpBGxT6oVzpJy8toKFx6peAJ1ICWnmniB1wx0lLqh
	4xIASgzRadqU/vzhJHjfsJN5vMETv4LItctHgf720ggocKKJtVn4kCa0
X-Gm-Gg: AYBFou1oDarHaXmCYA4sDiy6JjUIh7IajeH93qFUYh0lfJIG1u+KLoAD4RJ/+c9tbuS
	rDrMSSoCEdn0fPXYtI8WLuQh4FEQ0on/1kyLUZJV/zCQaZDvMZsxEwrZjkzrSsNvqgmzAjE8Yum
	zP1syNNGrQswfjtaRgH3qj2wQg0hfgEZa1TMBr30q0eob7pbofo0FMHK9l9zvAyvgO5entjdbBG
	s2zf2eJLnoTyhnQdCBqQFdlsyHcwDS3EiAzcuPIElPjN5eqB5Vfi5aopSTHS/i/7NrfsdZX52N6
	1wNW0lF96bvhr5Xp/r7uBuVpkjRjQhLxjpNF6UlU3D6xioWBfkOeQ6xQZflAV9UyIlRZNjQnpGS
	YcQ0G7r1IZDetANahMm/JC22fU5ETFC/Ojg1FJM0X7GxJsozrzzjDbIEgLkXjntdZKfsaIfBP3m
	VFbRha/MTGJd1CmoITjognS4gFA+L3bH/b4/Skwuz4Jch8z/dQ/PPCN7m2Q8iz0Alt+cxsO/VzT
	PDFe5WhUq7l5NO/DTUy4eUjbS68wXGCtutqQRaId/ozHeTMqjZuSZEhLEJx+SzSUd6QSTcnr0+M
	dQB9ZY3Cw4XEKMgXZavh0Gtw1Jh9YX5fdQ==
X-Received: by 2002:a05:622a:1aa9:b0:536:766f:271d with SMTP id d75a77b69052e-542b781f632mr306774901cf.51.1793835356393;
        Wed, 04 Nov 2026 15:35:56 -0800 (PST)
X-Received: from [10.0.0.48] ([71.69.222.122])
        by smtp.gmail.com with ESMTPSA id d75a77b69052e-54b10a63462sm36858141cf.15.2026.11.04.15.35.55
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Wed, 04 Nov 2026 15:35:56 -0800 (PST)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-Cc: John Fastabend <john.fastabend@gmail.com>,
 Jakub Kicinski <kuba@kernel.org>, Sabrina Dubroca <sd@queasysnail.net>,
 "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>, Chuck Lever <cel@kernel.org>,
 kernel-tls-handshake@lists.linux.dev, linux-nvme@lists.infradead.org,
 Alistair Francis <alistair.francis@wdc.com>
X-In-Reply-To: <sashiko-outbox-198141@kernel.org>