🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #10966

[PATCH net] mptcp: reject DATA_ACKs against a reversed send interval

#10966
From: Eric Dumazet
Date: Wed, 04 Nov 2026 13:07
64 lines
10054 bytes
From: Kyle Zeng <kylebot@openai.com>

ack_update_msk() samples snd_nxt before taking the data lock, but reads
snd_una after taking it. Concurrent transmission and ACK processing can
therefore leave the sampled upper bound behind snd_una. Active-open
completion also exposes a reversed interval when it initializes snd_una
to IDSN + 1 while the socket-owned state synchronization is deferred.

A peer-supplied 64-bit Data ACK half a sequence space away can pass both
wraparound comparisons against such an interval. The resulting snd_una
can make __mptcp_retrans() inflate a fragment's already_sent field. Later
ACKs can then underflow data_len and cause out-of-bounds page fragments
to be passed to TCP.

Read snd_nxt after acquiring the data lock and reject reversed intervals
before checking the received Data ACK. This keeps the interval shorter
than half the sequence space, so the existing upper-bound check cannot
accept an advance beyond snd_nxt. Preserve the existing handling of old
ACKs and keep the transmit fields under their existing socket locking.

Fixes: 7439d687b79c ("mptcp: avoid a few atomic ops in the rx path")
Fixes: 3f83d8a77eee ("mptcp: fix more tx path fields initialization")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
---
 net/mptcp/options.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 64aa7a516a23..02e785a14b8a 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -1122,9 +1122,9 @@ static void ack_update_msk(struct mptcp_sock *msk,
 			   struct sock *ssk,
 			   struct mptcp_options_received *mp_opt)
 {
-	u64 new_wnd_end, new_snd_una, snd_nxt = READ_ONCE(msk->snd_nxt);
+	u64 new_wnd_end, new_snd_una, old_snd_una;
 	struct sock *sk = (struct sock *)msk;
-	u64 old_snd_una;
+	u64 snd_nxt;
 
 	mptcp_data_lock(sk);
 
@@ -1133,10 +1133,14 @@ static void ack_update_msk(struct mptcp_sock *msk,
 	 * more dangerous than missing an ack
 	 */
 	old_snd_una = msk->snd_una;
+	snd_nxt = READ_ONCE(msk->snd_nxt);
 	new_snd_una = mptcp_expand_seq(old_snd_una, mp_opt->data_ack, mp_opt->ack64);
 
-	/* ACK for data not even sent yet? Ignore.*/
-	if (unlikely(after64(new_snd_una, snd_nxt)))
+	/* The active-open state sync can defer the snd_nxt update. Do not
+	 * accept an ACK against a reversed interval, or beyond snd_nxt.
+	 */
+	if (unlikely(before64(snd_nxt, old_snd_una) ||
+		     after64(new_snd_una, snd_nxt)))
 		new_snd_una = old_snd_una;
 
 	new_wnd_end = new_snd_una + tcp_sk(ssk)->snd_wnd;
-- 
2.53.0
Technical Details
Message-ID: <20261104130747.1045741-1-edumazet@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356441-linux-kernel-netdev=dewy.ru

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-356441-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] mptcp: reject DATA_ACKs against a reversed send interval
Date: Wed,  4 Nov 2026 14:07:47 +0100
Organization: Usenet Network
Message-ID: <20261104130747.1045741-1-edumazet@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3395325"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:o6kKq3WSyyn8AsNN7x/kCczf9EM= sha256:6K8WRg+Ez9n116CYL0bsDWMySvvTOeG0SVo8k2b0dn0=
	sha1:06FPDyYxic9j9xHuTJPDgBMe6u4= sha256:XzBSaXOd+jO0NCjm8vfNVlCmzZCtD9guJ95pYF5VwXU=
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 2DEC7112BD5; Wed,  4 Nov 2026 16:19:45 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	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=kernel.org
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 EoqGLdvZZTpA;
	Wed,  4 Nov 2026 16:19:42 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-356441-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id BD247112BD3; Wed,  4 Nov 2026 16:19:32 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id B1135295B1; Wed,  4 Nov 2026 13:07:55 +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=1793797674;
	b=ZqxAL2Mb3aN4D5HTOBo+eeyuoGF607Ke890YyKFdiaxj7NDO3e9d8sBvFwI/TvZbaa/x
	 Aq1NuYwuYSUbdkZa/Ux+fxovXzhm7sFeL2wbml6NjjODuhwOTL0wX9bEeb/emNy0gHyME
	 6CroYJ4vf7Bx6Ya+0wHyrjbQbR7bD/Qa3N7yRc9xb//AooiuhlBB/sS2Z1SbZ8QEqlw1h
	 KhPof2wdfoQadHivBXLQZd+nsnJSeEYFFbT01NP2fYkNYv+U4e7g7MWsBSQrGap4iYMGH
	 2Zy+ZigquMk227U00LSMw3wwkQfpew23TcGqBOxFkYbrNAiAzKzVV9AKZpKEKeK3sPw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793797674;
	h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=syN+KxszM/EDpPfFgs02hxOZ/ZWREys7/rnS23nuAlE=;
	b=VMDo3nWkwgP2+c1kVmmitfVWKip7FB/aZdB3Oa/L3iUlWHoDlHqLZXypFxrQHBkoI675
	 Sh3ISr6Z2Nb90Uy7GJJ82HHkW6rNwGcJlNMAgYQvfrKONZq2gOhSz6LSjY4e/+i6+3b10
	 46XtzMKtLshLikoF+qaT402UWKpzuKuigk8nAbzxfFSHY1E9ghBaQLanVaHFI6yXHa2fn
	 UyGRHmqTvlHDdrFLJGddJn+/oecHCVpn3lEtS1QPRsYqzo/X3Qanek+qQg8VzN9vNC8Wf
	 2Ra2d/XHmDYfQ8bwhq3fGwyTWlo37Kt+KYaj3ILfBes+nThq1YCrfE0YBf1+9PYTwxw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SJnhdI2I;
	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 C3F33606A32E;
	Wed,  4 Nov 2026 13:07:54 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SJnhdI2I
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793797673;
	b=SsldoPD+LXhWzprmjWP9AHC07LxbnmNPGPv/u1/onse0J14Ouwml+hohs33zF8uSwNDX
	 SXIgCsovv6f326/NU/AICcYFw08l+62dIt6wwe+tpBxYJHpkh3ATkgIotsHoT9d4DE+1q
	 r6IKtaKi9VRZAyOe4rbI53TjVst9GhJgx6F7P5GCE8MBdg0F1Y1+4WEoWO+R91q/zbGLQ
	 yB7FG8FFEIFLIkbezAXxMdHkrKFqYEI2ZaPmdz9mRA3CtKpdzU6JR18zUknx2L/vaHPBn
	 qBLa/0sJ7mMmFMV37ZCZABGwVnmgUmJ6t78jpZaQ6uzEugp/tEAfPkX+9Ryu1cKYB7w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793797673;
	h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 MIME-Version:Content-Transfer-Encoding;
	bh=syN+KxszM/EDpPfFgs02hxOZ/ZWREys7/rnS23nuAlE=;
	b=uX54wUEVdBN+OhqxcT8whkb8C2CEpGz4xrXknjAeBoOqYZRQlLjbqsCeLo5ElusVraXM
	 g68XsZDpUCIcFYMzf4CpPxZgccsCsebM8bwePOQOjBPcn2gkHdkbGzP3IbN5BjEP2NPhy
	 PSwds+SpGnYn8IC8lYy9wZ0VF5zlMBOk79sMp0FXH8cnSDmH8iQXUhIHhP3Rg3XctNSuf
	 +ovLk3zvyxw5UvssOilIeVlDHDT7w6lDOrdbzbVDj8Sp4Dt8sW/LDstiJsuvSrYl3/NMb
	 m0DV2R3/YQ4P+Jdf1A2hETrKVW5+gImpOPf1MMovSMhKbd5YOK5h8LcgFBdX0GGs6oQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SJnhdI2I;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98CE9606A31B
	for <netdev@vger.kernel.org>; Wed,  4 Nov 2026 13:07:53 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8F8F1F000C1;
	Wed,  4 Nov 2026 13:07:50 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793797673;
	bh=syN+KxszM/EDpPfFgs02hxOZ/ZWREys7/rnS23nuAlE=;
	h=From:To:Cc:Subject:Date;
	b=SJnhdI2IfqcGzRljkh5nil+pwIzBkghlSS3vwg0+M61NYsNa505ZchC5Y0jP9lc7h
	 KqdIBXgb+3miOgN8yU4OSiTY6pl15nvTGuUa1LxcFFobd4z7snZih22mhMy9iOk9Xs
	 JtSAJlr95Wra379/TtPf4Wo6zQtIj3cXcsIXqIsgr2YSFIXKmqyShEAK29iFmwIUho
	 2INLC8treLP6duC0bCpfO7pmQT4XRMPv+h1ACOS8fpOvJXUXeWfAYr855riDK4acOH
	 Wr7DLARoRNAHtQd7u/cJG14zAFyhh7JA5ak3JSyyle89OnkeqAsq60PRtnnORf4seB
	 RBx8fJjZJbnRA==
X-Cc: Simon Horman <horms@kernel.org>,
	Kuniyuki Iwashima <kuniyu@google.com>,
	netdev@vger.kernel.org,
	Kyle Zeng <kylebot@openai.com>,
	Eric Dumazet <edumazet@kernel.org>
X-Mailer: git-send-email 2.53.0
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