Article View: linux.kernel.netdev
Article #18205[PATCH net 3/3] tcp: reject RTT samples from TSecr above 120 s
From: Chris Mason
Date: Wed, 18 Nov 2026 00:50
Date: Wed, 18 Nov 2026 00:50
55 lines
9412 bytes
9412 bytes
tcp_rtt_tsopt_us() returns the timestamp clock minus TSecr as an RTT
sample, and accepts up to 2,147 s. If TSecr echoes an old timestamp,
the sample is the age of that timestamp, not an RTT.
tcp_ack_update_rtt() takes this sample for an ACK of retransmitted data.
tcp_rtt_estimator() clamps it to 120 s. The congestion control gets the
sample unclamped, in rs->rtt_us.
tcp_rcv_rtt_measure_ts() passes the sample to tcp_rcv_rtt_update(),
which computes sample << 3 in u32 arithmetic. That wraps from 536.9 s
on.
The fix used here is to reject a sample from TSecr above 120 s, for both
callers of tcp_rtt_tsopt_us().
An ACK of retransmitted data whose TSecr is more than 120 s old now
gives no RTT sample. So it no longer resets the backoff, as on a
connection without timestamps.
Found by LLM code inspection, and confirmed with LLM generated
reproducers on an unmodified kernel. Fixed by LLM, and tested with
the reproducers and existing kernel selftests.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Chris Mason <mason@kernel.org>
---
net/ipv4/tcp_input.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 10a23ee20e61..8de54d9804e1 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -901,15 +901,16 @@ static inline void tcp_rcv_rtt_measure(struct tcp_sock *tp)
tp->rcv_rtt_est.time = tp->tcp_mstamp;
}
+/* A sample from TSecr above TCP_RTT_MAX_US is bogus, not large. */
static s32 tcp_rtt_tsopt_us(const struct tcp_sock *tp, u32 min_delta)
{
u32 delta, delta_us;
delta = tcp_time_stamp_ts(tp) - tp->rx_opt.rcv_tsecr;
if (tp->tcp_usec_ts)
- return delta;
+ return delta <= TCP_RTT_MAX_US ? delta : -1;
- if (likely(delta < INT_MAX / (USEC_PER_SEC / TCP_TS_HZ))) {
+ if (likely(delta <= TCP_RTT_MAX_US / (USEC_PER_SEC / TCP_TS_HZ))) {
if (!delta)
delta = min_delta;
delta_us = delta * (USEC_PER_SEC / TCP_TS_HZ);
--
2.55.0
Technical Details
Message-ID:
<20261118005048.53393-4-mason@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365743-linux-kernel-netdev=dewy.ruReferences:
<20261118005048.53393-1-mason@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365743-linux-kernel-netdev=dewy.ru From: mason@kernel.org (Chris Mason) Newsgroups: linux.kernel.netdev Subject: [PATCH net 3/3] tcp: reject RTT samples from TSecr above 120 s Date: Tue, 17 Nov 2026 19:50:51 -0500 Organization: Usenet Network Message-ID: <20261118005048.53393-4-mason@kernel.org> References: <20261118005048.53393-1-mason@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2466003"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:/TKxtwe06xEfUew5NhcAPtMifJg= sha256:nrTMmL8OYtn4lUYZBJJYo512WhtXMOeOZAa0lA1Q45I= sha1:JClevp/nVugPURtvbr5rRyxQyr0= sha256:ocFxjAHpsEamFjPTTrygZUU6prJEhXiIyyIkqLxRr84= 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 21CDD1150A9; Wed, 18 Nov 2026 03:51:17 +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 QUmf4bV7s_M4; Wed, 18 Nov 2026 03:51:11 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-365743-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 29A281150A3; Wed, 18 Nov 2026 03:51:02 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id A6EE844A85; Wed, 18 Nov 2026 00:50:58 +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=1794963056; b=UEYkEMOwSswQFeMRZqC1PMRqY1+2KpMQF1q7MLb0Az3CEgPso3zZzjTFMLjLVG510Rfd i6Vekojg6uf0EPFkjpz0bazgKKUyWs5E6drLs2chsLfxn1FSEAbn8pHiKniJjb83Hl9ug ttcwtfiI0NT8hmf45Cm1n7Qef9IMSj6/rNfZsu6KngeDKYSN2m7ki9RRMIF3JnGO82GLO If3WzlLNkJanZyM6HqklnTBeNMwcZ2f2RxPzdOtSZZ7EwYTk24gFE+YZ+cfBHMIeHga72 pmppiEN5/xYCt3I7FZ5OcZH7Gl0440nGsdHfhQ80wKieRp0NLf8vkSuNmrJenXle0Og== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794963056; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Subject:Date: Message-ID:In-Reply-To:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=PhPJEJghdDWbERy/q3n4Hzr9Rm9mUGxMcJTwgKd0XyA=; b=chloNYdxyEWBC5U4le55j5MMpv+CHrnCGw51KrDL2LtqCxJTTHgngz9gLPdh0o/oBfzs Jp3DivbvKwbIDJpBG3wHSk842/cFsKEjTRVWIMNPjLIhhZqRgdEVqmndiSRnxJELBcz5u qQoixtB0OfUAfM8RkWsvbGOBbdGQaTT5vC92SncT/5JtmRW2CAyTvIdipVLsNA/L7w6Vk tn8vuMhzbXypKGpGF8s8VQOdqmtmSmEoC/iP7ptUNLcPATWeLwesR1ZTg/TB4hwnfaF0l Oqjh4xgrTZDIcF6wHfQemRByMt2qkKXxkbmnje8ivCiLpA7auVRJDJxlBqNv9DxJ4gw== 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=DhrETlcu; 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 E2E15606A33D; Wed, 18 Nov 2026 00:50:55 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DhrETlcu 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=1794963055; b=TLALIVhTbFBb7jCKSD9WKuEu0Hqb29VgLcwEV0nUFb1mZRGM4iRCzpQxcB9vb0O+S0SU TG7/dP3PknSHiUxkQBYHCh1RCyx06JOFxRekJPpYKUUg2+SLIwYCG9R1Zfu7yclug9Mrb UL8p1gpklnNCnAx/WpPT4AoDSAQ9snIyGwIMTP+3bPMfHSpc+KuOIrF5k3GZT8CHW8YUD 1eXLlkpK1fTdcaV84iplV8gfXIv6FAybIWUTvfRfjU4ie8Z4lsVA5og+qlyixRt40NsGy iXblGJCjMKFCV3fZwix1y/DTIP/mcimOWVlvsX2rjWJaOpDMoDRf6bK/Pebce1N46ww== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794963055; h=Received:DKIM-Signature:From:To:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=PhPJEJghdDWbERy/q3n4Hzr9Rm9mUGxMcJTwgKd0XyA=; b=n/wRfhQSb9Bm0phmBtKlRAIb619FeRioyW9xzvid7s7urgbtoTMpvcigGA6zexZuY05/ jgo6QhBIJDJad3YnviKjMpCdmPLeYS5mio+/zM8odnYcnEev7OmM6/OQB4ETkHTtp1EXM HC/l7EQxb5gCr9hFrMGz3wWa/dqAjGOIwdWeBEtqPcBLYi4APuNilQQl4bRBPFxrbSpoY gBy973dC5EzvNee1PKoqaUMkahEP6tnQoMyw0UY3CUJd3tAC21/5o9rXMSkVAC+/VpuaI iVi55h/oLX7RUchjWiLxpGMCms/E8EinZ6wGjQkNwwUAwGqG95x4jH8ZkWTCybK0HXA== 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=DhrETlcu; 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 112B7606A334 for <netdev@vger.kernel.org>; Wed, 18 Nov 2026 00:50:55 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC3BA1F000C5; Wed, 18 Nov 2026 00:50:53 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794963054; bh=PhPJEJghdDWbERy/q3n4Hzr9Rm9mUGxMcJTwgKd0XyA=; h=From:To:Subject:Date:In-Reply-To:References; b=DhrETlcurKYwscaNgyVqczZ615lsfJKIuMTiYe6qyuL/KJbmGpypdZeOc7d9qYv6Z m2/7yrMrq2ppviaQRFz9rsjVHqtu/0xc/l1XJrVdBUU67NBtT32L97uXlAkKy9IPcy 6iqBy1rxe2XAg9B4F21rX5Qy5Id5DGblfVg16iISpzdlQKYgtLetVcQ1DYL2fFOOqM F56Mb14VEhYC+Pr5l/AYQWP4cx6UHhB6inhlXmSqgCOl5gdwPLW+25xZYLbgsCvDBE HgTvj1kngmwyQuxFE1wiT5BaEfHCuQnPYD2USgd4N1TiSqXnaPLIM4jyapkeUtIcB3 v/Zgpl3YwwgiQ== X-In-Reply-To: <20261118005048.53393-1-mason@kernel.org> 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