🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #18622

[PATCH net v2 5/5] tcp: bound the rto_min of a route in tcp_rto_min()

#18622
From: Chris Mason
Date: Wed, 18 Nov 2026 15:51
60 lines
9448 bytes
For a route with a locked RTAX_RTO_MIN, tcp_rto_min() returns the metric
as it is, and that can be any 32-bit number of milliseconds. All other
ways to set the minimum RTO have a nonzero floor: the tcp_rto_min_us
sysctl, TCP_RTO_MIN_US and TCP_BPF_RTO_MIN.

Both ends of that range give us trouble.

With an rto_min of 0, tcp_init_metrics() can start a connection with an
RTO of 0, if the cached RTT is below one jiffy:

    icsk_rto = crtt + max(2 * crtt, tcp_rto_min(sk)) = 0

It sets icsk_rto itself, so the lower bound in __tcp_set_rto() does not
help here.

At the other end, tcp_rto_min_us() and the sum in __tcp_set_rto() are
u32 values in usec, so an rto_min of more than about 71 minutes does not
fit.

Clamp a locked rto_min to the range from one jiffy to TCP_RTO_MAX in
tcp_rto_min().

ip_metrics_convert() could reject these values instead, as it does for a
locked cwnd of 0. But a route with "rto_min lock 0" is accepted today
and mostly works, so that would break existing setups.

A route still shows the rto_min that it was given, while TCP uses one
jiffy or 120 s.

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: 05bb1fad1cde ("[TCP]: Allow minimum RTO to be configurable via routing metrics.")
Signed-off-by: Chris Mason <mason@kernel.org>
---

Notes:
    v1->v2: new patch

 include/net/tcp.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index a617a72ee2c6..27de546dc802 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -939,7 +939,8 @@ static inline u32 tcp_rto_min(const struct sock *sk)
 	u32 rto_min = READ_ONCE(inet_csk(sk)->icsk_rto_min);
 
 	if (dst && dst_metric_locked(dst, RTAX_RTO_MIN))
-		rto_min = dst_metric_rtt(dst, RTAX_RTO_MIN);
+		rto_min = clamp(dst_metric_rtt(dst, RTAX_RTO_MIN),
+				1, TCP_RTO_MAX);
 	return rto_min;
 }
 
-- 
2.55.0
Technical Details
Message-ID: <20261118155144.18393-6-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-366261-linux-kernel-netdev=dewy.ru
References: <20261118155144.18393-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-366261-linux-kernel-netdev=dewy.ru
From: mason@kernel.org (Chris Mason)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 5/5] tcp: bound the rto_min of a route in tcp_rto_min()
Date: Wed, 18 Nov 2026 10:51:49 -0500
Organization: Usenet Network
Message-ID: <20261118155144.18393-6-mason@kernel.org>
References: <20261118155144.18393-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="2633488"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:sok7sHYBFEfXd8YI5fOSdSohqFE= sha256:k6ZEsmvAoCmNm4W2RyxjUzKV9fqWBI4cBfhc5Dpp6hI=
	sha1:W79wi45CaZCyeuEaRwMno5tsQyQ= sha256:UUlZ5msdqIdHy3z8Ksh6EbGBC4jLfVulCKXWB1bW99M=
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 58071115317; Wed, 18 Nov 2026 18:52:37 +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 uorqAilOT8xN;
	Wed, 18 Nov 2026 18:52:30 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366261-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 388D011530D; Wed, 18 Nov 2026 18:52:21 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 7DC3A2FA44; Wed, 18 Nov 2026 15:51: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=1795017115;
	b=KKJuAYY8/AocTwCqiidFZHgXbhMyc7PEa8CHtdkBsr3bUsf8vmojdTf8cVRz/YNpwHvR
	 LD2wqYx3X7Kcqz7Qt38WROUoZCrtjNCX6F+lb4KBxWRtJtvqzIzpUTbKFA6xgfSUyVkY7
	 HfvrmFGaELPoEM4RBGwNReumWWBipeuT6KGN3skHYkEFyMds1H6pyaKHkLDCupcHhbUGr
	 g1THWdyhUDrtNLddEgmU2IduMcbXA6pX3KUWvm4hffjvqv4PEEOitSYBjDaqd6SVwuHiO
	 XjG4WRsA80GJKQVwtjaMe086nCI9NTN62Qf3jOKqTD6ngNrqSbxsH2k+yIGWxxcEYDg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795017115;
	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=OJBDrN2zdJBfY626xTCxR6O6ZovLR6W8RrDx3Z8o96g=;
	b=4rAR84Va8lrmAmrgyFH9DJVXui9xHO12gicEsMRT4JoydMSNXTxhyvnQprYWN0FwQ/6s
	 s+vU1AzUxOC0jd4x35p4Vv2o3CAkv25r9bDzeldKj+WX1i3ikIqw5WCF/Ct0wzoqyqsTS
	 A4Irni+tZJm42ob+Yti1LwZGlCJQLmtG/4ODusHjS0Fou9l20dDM2mdiMtr1HR9Dopb1m
	 L91PT3S5izEaEMT+QMF5+CflwL+zQ5+j2NBAZD/Ekensd9QrBTmD0FqKyq+FIMhas8LdU
	 MP2w8G2Ex8MYzvOLtRzExh+DVWqhepMxUrzKkP05uprqMZ8faRBu+q0y1z/N1O5+J1A==
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=f0Yq7MFT;
	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 197B2606A333;
	Wed, 18 Nov 2026 15:51: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=f0Yq7MFT
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=1795017114;
	b=RLgEEEQRV3D0CVeMjQjk/nap4AsYxzKWtbYkDC387h6tvOO6ErtuoxRheAjmAD3YRJ5f
	 5y74P/BOYayMDjUP5mq5gBW0b0hFVCpnjgLG3LjUkX2F+8UEc6xrSOqHsy3cPPSQgZImS
	 67Ht9zZOj68Wlzb/0PiIOh2G2MwlWOhiokCYQIuADVwSBpNnS3dXpqG2Rgx+9h6XDzRtY
	 BDtZ8+L6IcWSsM1s1kv4+k4w/WJBtAHToONmB9Hxb1cXwPhuFK3RLISyhjupHSZR777V+
	 Sm+If9GZYtib5ofgIhEgHPPcF0sFTBKmNeyP5rkv6ga/zvg+OyoBTVHGezrKT4BKJAw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795017114;
	h=Received:DKIM-Signature:From:To:Subject:Date:Message-ID:In-Reply-To:
	 References:MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=OJBDrN2zdJBfY626xTCxR6O6ZovLR6W8RrDx3Z8o96g=;
	b=nNclGIraxNXpnHREr0ANQ0Cjr6NKkU0iVqqBdXZLKokuEkfRscPACPyZyjQmOB9uNwY/
	 mWXN2NF3dRngeOXCO4CtDdK1w180aPv3SOPYHnbFWdA5caD8ZpzaeoaNsjTz/DDzNqqd5
	 wUGm4dETpgHz2LdSj0nqCjWyFMYkj2ISSpx1ItMbL8DMy6SbUBErC5sjHw0XZU3+brwqk
	 m/IK7jWRv1BIdOZi3bJ+0kW5oUTinS8Un5T29xX0/nVUfyqejNhuDOf9Puo3enHw+FpWy
	 tZfYOFR1XixCDUrOIHxVYV8lcdbXatBgExFjolFsLeNDJU+mLwbQUVhEsM1LiiZ8H/Q==
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=f0Yq7MFT;
	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 3D59E60A2600
	for <netdev@vger.kernel.org>; Wed, 18 Nov 2026 15:51:54 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id F32D21F000D1;
	Wed, 18 Nov 2026 15:51:52 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795017114;
	bh=OJBDrN2zdJBfY626xTCxR6O6ZovLR6W8RrDx3Z8o96g=;
	h=From:To:Subject:Date:In-Reply-To:References;
	b=f0Yq7MFT2oHU1V7CE4fCVRPuZJFcayIDxQpp3STCl5KemFO3hEDzZRpKkTcoSudo/
	 x3eYZwWeiiBq1yrLYzAXmcNRXaROhTCm8PEyTyOX5PhEpWLlzSyhRAOfONK49CPG9M
	 Uxc0s8SkDRpo/+PavEojWg3R/cc++VVVzSErLOFHWlRmFp+X142TLGtRTE9nqwSn/S
	 PwfcWcI1XO9qmch/ORSUdPh5PFUrBU11JANiksrfeEgt4PHlmMZ41JaqQyV4zn+emR
	 NdEIALwSdbbd81BxXGdOkbFpqpvWWw2OAQ1KfVVTNb0Bn+VjugesK0ZrAA5hjA1JIv
	 Scdj++DE5cCrA==
X-In-Reply-To: <20261118155144.18393-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