๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #18677

Re: [PATCH net v2 3/5] tcp: reject RTT samples from TSecr above 120 s

#18677
From: netdev-bot+sashiko
Date: Wed, 18 Nov 2026 18:23
76 lines
10824 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The header comment for TCP_RTT_MAX_US is out of date after this
  patch.

--

tcp: reject RTT samples from TSecr above 120 s

This patch makes tcp_rtt_tsopt_us() reject any TSecr-derived RTT sample
above TCP_RTT_MAX_US (120 s), in both the usec and ms timestamp branches.
Before, samples of up to about 2,147 s were accepted. Both callers,
tcp_ack_update_rtt() and tcp_rcv_rtt_measure_ts(), now get no sample when
TSecr echoes a very old timestamp.

> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index e796497b84be8..69e038b9389ae 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))) {

[Severity: Low]
This isn't a bug, but should the comment on TCP_RTT_MAX_US in
include/net/tcp.h be updated to match its new use here? It currently reads:

/* Max RTT sample for tcp_rtt_estimator(). srtt_us holds 8 times the RTT, and
 * mdev_us and rttvar_us up to 4 times its deviation, all in u32, like the sum
 * in __tcp_set_rto(). A larger sample could not raise the RTO, which
 * TCP_RTO_MAX bounds.
 */
#define TCP_RTT_MAX_US	(TCP_RTO_MAX_SEC * USEC_PER_SEC)

That comment names tcp_rtt_estimator() as the only user. The only reason
it gives for the value is u32 headroom for a saturating clamp.

With this patch the same constant is also the validity cutoff in
tcp_rtt_tsopt_us(). That cutoff covers more than the estimator: it
decides rs->rtt_us, the tcp_update_rtt_min() input, and whether
icsk_backoff is reset in tcp_ack_update_rtt(). It also gates the
receive-side estimate in tcp_rcv_rtt_measure_ts().

The later patch in the series, "tcp: clamp the samples in
tcp_rcv_rtt_update()", adds another user, and the header comment is still
unchanged at the end of the series.

Someone who changes TCP_RTO_MAX_SEC or TCP_RTT_MAX_US because of the u32
headroom reasoning would not see that this also moves the TSecr rejection
threshold. Could the header comment mention that the constant also bounds
valid TSecr samples?

>  		if (!delta)
>  			delta = min_delta;
>  		delta_us = delta * (USEC_PER_SEC / TCP_TS_HZ);

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118155144.18393-1-mason%40kernel.org
Technical Details
Message-ID: <179502618234.3136.4048099006829780599@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-366333-linux-kernel-netdev=dewy.ru
References: <20261118155144.18393-4-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-366333-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2 3/5] tcp: reject RTT samples from TSecr above 120 s
Date: Wed, 18 Nov 2026 18:23:02 +0000
Organization: Usenet Network
Message-ID: <179502618234.3136.4048099006829780599@kernel.org>
References: <20261118155144.18393-4-mason@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2663271"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:SrxfMZAdlyMWE9UHp9Y1IgvB3P8= sha256:2MqRCte2siUmN7ikiHqmyW6GHIFfyWgo+eq4DPO6hWI=
	sha1:IL4b4m1duqNhNiFF1YHSsc6wUNI= sha256:ZuUd5MG1vD1yV6OID5LhgCp2r8RGef9blc5Ik52m9f4=
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 20A02114CB4; Wed, 18 Nov 2026 21:24:26 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 uL2SB5FH9fst;
	Wed, 18 Nov 2026 21:24:22 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366333-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 4A879115359; Wed, 18 Nov 2026 21:24:14 +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 0335BC8825; Wed, 18 Nov 2026 18:23:27 +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=1795026184;
	b=0igYND3eKHn3zSxqa0n2Hk05PhABW+h8GqcfJzLcqi6iroHBXeWto0Go/IO3TtYXEb/e
	 CH86vtjPxGNwwfOtrf4ozFhzD+rGpOl/jmL94uhtSfof+wL0b2+XMhxCFAngpaKigTZ+/
	 0eSPs5i+ges5OMmEPzUW4lenq0Ggbml6ETJ8FvuIPrIv89BZLPNQKh+x2xS5oD0Pfs6Wt
	 oUT7CAYci5zkOTFuRt26gWoRB0sZ37VfNjE66JIZ/6RrU6MrwQBJoLIpVx4O0kQx11VWq
	 ermiawq1DN8In4qJ+dSF6LLNXgnh2RIC54Zg2PxOiE8/Cz2OO9sKTHTh9H27ebst7ew==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795026184;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=lNuKjpJK9D+QRY5daBoPqTUSuR+D+q18m5okL3/K2hc=;
	b=GndTI+cTSiQszLoTUwYD5JLGKekmXn9LRpKzoZ808DMrAQBaHy/Bire5/K9Zc5CBdHal
	 PeHXpZPk44SiOqQkmBwLdJzEPw7UNkk0efz5JSH8BSlkEoI6cm221kVOLN84Flu3mZUyy
	 Zlhc5HXztsFasFSnyfLBdt8a95zQZHanuIrL+Bq1eM8qh6VSlQUYwiQpDW40OPLOFEJUN
	 oPlbjZ/CS39E74sJFFl7h7W7SXtazUbaVEzGyejBJ9gxf3VcSrxFgDA9TydPqO6HPJIrc
	 ZCfJLVKbx2UPks4p0+JSKfHyAPsqGAVEijhBaRO9d6cr+Cg1pXSxGdNSxKIxO3pe5kg==
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="kpE/GwEw";
	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 52D5760A3836;
	Wed, 18 Nov 2026 18:23:04 +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=kpE/GwEw
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=1795026183;
	b=kY0RKRuMGFaFLW/A5vrYLag9lj6oY9rMxnORTmktVs2dXawPEy0NxZepCsEj+/+Y++Q1
	 pFrK0gP1utfK+vfBBTEoQb0YxkBYm+5ftJ1Q+uqjA/0Da9Z0p/tC4yt5iIYhTFzSGgeHp
	 oWLPGWcuAGvtmGo69EANLRKYL1Kmb8w14DjjH1V6fpFewRS6tUUK9hakqRcLGVutgGmW9
	 kaT07gqKvvvuBBgJCzsWE9lbFM84iwRdJMo4uyT7PqKpOMSSqZSRSDVoQEIpNsDRz9ZGB
	 LYGgIjOizl8Grs+Hxvojyk2SvbJfQbAnn5rIZxv1LC1MiPJn0kngPPmrnq/2BGKQV3Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795026183;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=lNuKjpJK9D+QRY5daBoPqTUSuR+D+q18m5okL3/K2hc=;
	b=Cy/mdTs8aAlF0+dGezpM1MqOBuq5UTJh8zncWfa0JEypwU20B8ddgJND8pRG2/Y6LXyH
	 GK/9jlvNYH8qafr6aKGrw+OY5T2dDjsvlix7SM7IoZdlPfoTjReaKznQrVn1TDs/fq7A4
	 VqLBMct4TglChUlVqnip5+OvfDe0H10OmKBMnqOE+PJzebZ69uP4rd27sHLxRRBPpjcq1
	 czOz4agLZhmwE/mjjDNpHO4gg7WizEzrwdOf3QRlf6WPwRVX34a/0TFiQtFJkVjJfQd9E
	 L3A4Wyx0/vFeW5luZQTzcRl+v47q3Go2DcYTBu2qX4FCmaATb116GQjqFwMFIk5zjBA==
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="kpE/GwEw";
	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 72E4A606A336
	for <netdev@vger.kernel.org>; Wed, 18 Nov 2026 18:23:03 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD5291F000D2;
	Wed, 18 Nov 2026 18:23:02 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795026183;
	bh=lNuKjpJK9D+QRY5daBoPqTUSuR+D+q18m5okL3/K2hc=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=kpE/GwEwVXzj1fPydacHZtjh4LSw8b2otfovA7chQe3wftBaJodvhCtX5vMVOxcgt
	 rw2vVMs871/sLt2G9CvdzKlAfu6Datyh26jiANjQ6PhSZFMupAaOL5MipDjRgxp/6+
	 /DfV95wYF3x1RI3mPbnYL1jM7kvgkTbUxlIvKABJKvRjFa21pbYjf9IaR0m8Hqxl3I
	 rAYQZds2/GMziBAefNXvAtCRzoGkm++j4q3qoJfocFHXXCGlEyKyBE4+aSGQ+hDTV+
	 hcIuK1ZcCtGF+4WPyfbyYPrkAGle8MvtX1UlGTbGUvfkOSrOh6FMNK0YFvwF6QAqJj
	 a4MPysD7bvd8Q==
X-Cc: edumazet@kernel.org, ncardwell@google.com, kuniyu@google.com,
 davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
 willemb@google.com, josef@toxicpanda.com, netdev@vger.kernel.org
X-In-Reply-To: <20261118155144.18393-4-mason@kernel.org>
X-sashiko-severity: Low
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