Article View: linux.kernel.netdev
Article #2708Re: [PATCH net] tls: refuse RX records after record-number exhaustion
From: Sabrina Dubroca
Date: Tue, 13 Oct 2026 09:38
Date: Tue, 13 Oct 2026 09:38
61 lines
12366 bytes
12366 bytes
2026-10-12, 18:27:01 -0600, Rishikesh Jethwani wrote:
> A receive socket records sequence-number exhaustion only in sk_err.
> After processing record UINT64_MAX, it advances the counter to zero and
> reports EBADMSG, but SO_ERROR or sock_error() can clear that error.
I vaguely remember a discussion around making some fatal errors more
permanent (ie not use sk_err).
> parser-ready record also bypasses the socket-error check in the record
> wait. The receiver can then accept a record authenticated for sequence
> zero under the same exhausted key.
I guess, but what's the problem with wrapping as long as we don't
reuse the same record number?
> Getting there needs an initial record number installed close to the
> limit, since 2^64 records cannot be exchanged in practice, and a peer
> that sends the wrapped record, which the Linux TX path refuses to do.
>
> Mark the RX key exhausted when its record number wraps, and refuse to
> wait for or decrypt another record under it, or to replace the key.
> Plaintext that is already decrypted can still be read. RFC 8446 lets a
> sender retire a key with a KeyUpdate as its last record, so in that
> case leave sk_err alone, report the pending key update as usual and
> let the new TLS_RX key clear the mark.
>
> Add fixed AES-GCM wire vectors and TLS 1.2/1.3 selftests for queued
> wrapped records, SO_ERROR clearing, splice, peek, partial reads, TLS
> 1.3 key replacement and a KeyUpdate in the last record. Every case
> first verifies the penultimate record succeeds. The vectors avoid a
> userspace crypto dependency and the TX path's refusal to generate the
> maximum-number record.
For 1.3, just do a "silent rekey" (change the key but don't send a
keyupdate) on the TX side to record number 0 with the same key? And it
should be enough to test this with just 1.3.
> diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
> index fbb274287aa5..63bef0153182 100644
> --- a/net/tls/tls_main.c
> +++ b/net/tls/tls_main.c
> @@ -730,6 +730,15 @@ static int do_tls_setsockopt_conf(struct sock *sk, sockptr_t optval,
> conf = TLS_SW;
> }
> } else {
> + struct tls_sw_context_rx *rx_ctx = tls_sw_ctx_rx(ctx);
> +
> + /* Only a KeyUpdate may follow the last record number */
> + if (update && rx_ctx->rec_seq_exhausted &&
> + !rx_ctx->key_update_pending) {
I'm really confused by this.
> + rc = -EBADMSG;
> + goto err_crypto_info;
> + }
> +
--
Sabrina
Technical Details
Message-ID:
<as37-A3DKONrFuxs@krikkit>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-345510-linux-kernel-netdev=dewy.ruReferences:
<20261013002701.1957686-1-rjethwani@purestorage.com>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-345510-linux-kernel-netdev=dewy.ru
From: sd@queasysnail.net (Sabrina Dubroca)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] tls: refuse RX records after record-number exhaustion
Date: Tue, 13 Oct 2026 11:38:00 +0200
Organization: Usenet Network
Message-ID: <as37-A3DKONrFuxs@krikkit>
References: <20261013002701.1957686-1-rjethwani@purestorage.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Injection-Info: usenet.network;
logging-data="2015109"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ph2fROBctVY6rx4XI5ppS6yQus8= sha256:iVkKKqPPAZA8dLKz8kUl6LgxmyvW0SkLDu0QjQfe8vg=
sha1:SaUG2uSvv91nH1W851y1dnr5jbU= sha256:izer0kO1uOgHfjXA/hmfO0a5k6xoD9kA8DeLD0Amkpw=
Content-Disposition: inline
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 D755510FDE0; Tue, 13 Oct 2026 12:39:39 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.851
X-Spam-Status: No, score=-0.851 tagged_above=-9999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
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=queasysnail.net header.b=d7Pj2hLV; dkim=pass (2048-bit key)
header.d=messagingengine.com header.b=DMS5V+0H
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 A9ibxGTi30Vl;
Tue, 13 Oct 2026 12:39:36 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-345510-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=queasysnail.net
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
by mail.dewy.ru (Postfix) with ESMTPS id B671310FDDC; Tue, 13 Oct 2026 12:39:21 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by sto.lore.kernel.org (Postfix) with ESMTP id C9A23609ECE; Tue, 13 Oct 2026 09:38:36 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A29103FF1B4;
Tue, 13 Oct 2026 09:38:08 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=queasysnail.net header.i=@queasysnail.net header.b="d7Pj2hLV";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="DMS5V+0H"
X-Received: from fhigh-a1-smtp.messagingengine.com (fhigh-a1-smtp.messagingengine.com [103.168.172.152])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64B523FAE15
for <netdev@vger.kernel.org>; Tue, 13 Oct 2026 09:38:05 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.152
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1791884288; cv=none; b=YKp4H+tn/DQ4+iF83gMW26sy+3OE7k1czubkwX+yjIT14Egp5e/5cpA6OsZepgJGx9NUdJk3mJ5ZMEr+wjAZocQTwpROMp/n3OdELm+RDl8oKPIPkTq7+MIEHSPeT9HS/UF3h7fYn7wuEdslDTUXQcHp6lVPpS6AAZJH3i/Tk7g=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1791884288; c=relaxed/simple;
bh=7CTQPPO2qQ2ZoSuCsvkYLKcbd9ZRQEFN8AaPBnDBHcU=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=lf6kaOd5lGgUDZrTgTbfe7N633CBfubz7FrjwHlxHolxeGaa7uYySz+sYE3Rqn9VxuuwxK+WahHtQj3ZIxjzFIHEo9WRMIDxGjBRtI1vjv13dQ6tE+HcZkPvnQwTOi6oA5vtBnhHu6xAb0Zu61hWX9VvCmLGCG81WmaiyyEcDL4=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=queasysnail.net; spf=pass smtp.mailfrom=queasysnail.net; dkim=pass (2048-bit key) header.d=queasysnail.net header.i=@queasysnail.net header.b=d7Pj2hLV; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=DMS5V+0H; arc=none smtp.client-ip=103.168.172.152
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=queasysnail.net
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=queasysnail.net
X-Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42])
by mailfhigh.phl.internal (Postfix) with ESMTP id 6C74B1400169
for <netdev@vger.kernel.org>; Tue, 13 Oct 2026 05:38:04 -0400 (EDT)
X-Received: from phl-frontend-03 ([10.202.2.162])
by phl-compute-02.internal (MEProxy); Tue, 13 Oct 2026 05:38:04 -0400
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=queasysnail.net;
h=cc:cc:content-type:content-type:date:date:from:from
:in-reply-to:in-reply-to:message-id:mime-version:references
:reply-to:subject:subject:to:to; s=fm3; t=1791884284; x=
1791970684; bh=LQCntHHIX/z5AYDFTk7naJrzWzZHIxRMf2UeBMyYXa0=; b=d
7Pj2hLVNapNGRQ7wnzfXMXOgvRCR1WjokoAkJKXpfrqCNjb0EilV7mT4pbpdZ5SO
j7TZjIt2+iFi4ofhRFbOhKsFH6xTicEHXV6NTQ91Gs+clfytuuhpBNiDfkzWE8Vg
8EhpiQ3U2fufHakCY/sNtmIdfCZCPLWacUkSMCFrLvxv95LykjiaUP9vo3WnZCQV
+qXhpnGCPU2WHUZ4tu2MO7bdIeIOTS/vC9pdZpYPAMoHPU9LU9vDJhVH338tdnHj
FsmYXfTyq79KQqVHT1rL6yQ5WTnP6OsyopRi/xn/iHkPX86lVT/OU/vAn9N8Th3M
OA/YnAxWJOc/aiJ95h4zg==
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-type:content-type:date:date
:feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
:message-id:mime-version:references:reply-to:subject:subject:to
:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=
1791884284; x=1791970684; bh=LQCntHHIX/z5AYDFTk7naJrzWzZHIxRMf2U
eBMyYXa0=; b=DMS5V+0Hiq7+a/wm86w/K4lryF6eUVIC4wItQvci7eekzLMu/xn
BMRRurukeP/ZBa+BuLl10YYWknmYIzJc8JURAZbkfz5uiY9pXa2k2pYGwha53DcG
8+zS0A4+RrLlX62uCo83HNoNOt+zMfSlTPK5hhCiUfAi2BsehfLOiA7cw32IMMKc
ENwMtPXGG1Yqt8FwuWIA7x9h7eHclb2BlaHPMxHEluPSTJdiUXK4rwMe9LzKpBMP
ZBiKPzzhXWv4v41DySz/ijO0ACESyUTjfsDShAcUAIgXtrAwsMxrTrbNU2N/CnLn
Iee5iRLTcteLRkeR6hzv/20d/wv/fze1fZQ==
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-06;
repo=github.com/dkim2wg/interop; date=2026-10-04; sw=lmtpprox;
action=sign d=queasysnail.net a=rsa-sha256;
X-DKIM2-Signature: i=1; m=1; t=1791884284; d=queasysnail.net;
mf=PHNkQHF1ZWFzeXNuYWlsLm5ldD4=;
rt=PG5ldGRldkB2Z2VyLmtlcm5lbC5vcmc+;
s=fm3:rsa-sha256:DuO9v20ZFxF70c/9sDIJGxSPNDrPVYwB0LM2K0cK1PIipZb
vATZ6TKgu0hAs8H9Apksl22j9Xq+XMXg050GRnKHpjJufdpysQb+Zs/fr2i9hrL6
YasEta3fvxj02Y6g6psWUP6vDEeJICzD7Q9eSDGzwS7MqHscf37XlKcaBrsyvIAm
w19t/BsydCKL3JB2Fx70y8khLzbWTP817jg09+xRmywIp4i8IStoEP1TfgdxuVOc
7MLRfNIMI+ixRnvgDJN7gBG/S6ZNbqQMLRxJkcbc4UrH1KFGvxliAwHk/Q2olRpc
hBrnjY3tyMikqQ41fLAKt23FdYEiVlbVFxdbvww==;
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-06;
repo=github.com/dkim2wg/interop; date=2026-10-04; sw=lmtpprox;
action=mi-m=1; hc=12;
hn=cc,content-disposition,content-type,date,feedback-id,from,
in-reply-to,message-id,mime-version,references,subject,to;
X-Message-Instance: m=1; h=sha256:jq0AKZ0ZMZ52TQNweCflPClrPK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-e5p4EYRbk7cay6Mqwv92RB9TBLidOitTBA>
<xmx:-_vNaj-q-iepGO2biJ0HTir1qhMX1sfxEuaVjAiap2qp2xxp7WH0fg>
<xmx:-_vNavRV4Ww0K_egHdmo8LHEcN96JtmTBMhqjWWZXNO6rOXh8Y9OfA>
<xmx:-_vNalVkloa3BASndxzqEFYGka7Rb8tnmdb_YYw6z72EGSw8pO9GIQ>
<xmx:_PvNakNbSIQX86AxZJ3DY9bUZugZ_TXWHVYGTn4dWQOhJ-FK5N-BNel2>
X-Feedback-ID: i934648bf:Fastmail
X-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue,
13 Oct 2026 05:38:03 -0400 (EDT)
X-Cc: Jakub Kicinski <kuba@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>, netdev@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <20261013002701.1957686-1-rjethwani@purestorage.com>