From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796330758; b=Cfp6+Q6IQXH1nz59RUw0/iGWUgWmeQ9BY2klL0Q3+8JVwJRmWiOxej4JbH7sbx5BBrpi PKqd46iURjBPMqewmUIqYa3Ujt0YcNjCCVxlDC+Si0zzjgpLW72ROXxHewjygMq+ED5H2 jm0SCHZEsdgzwpb9Ixb0yUuA2e+m/o51JaLdum/eUfvyZii2fk4wm49WV3ELnqSW/okzO 6MYAUnDHkm82j3US/6MEfwMnWMCHnGzVRaXtpElf/mF+KrPfzEbfj964RzLm7BP5W+6Xn AuTQSh5sN+spZdnTTcaTZg7z/Hl1UeWM/ZRWy9IF/VmPvertpPre9RNmlq+tpqWR4kg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796330758; h=Received:DKIM-Signature:Received:Received:X-ME-Sender: X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID:Received:X-Mailer: MIME-Version:X-ThreadId:Date:From:To:Message-Id:Subject:Content-Type: Content-Transfer-Encoding; bh=FyH31y5ZmkdbUBySI/CPEhIq2Go5W50/GMg29glNJO8=; b=bkJfvZeYLmsSWokK1Ru2nV1kmrs07atlBSKdwMNdq7n590HDCgWumGlAXE2TaoUoaqY8 dS4qqzCW81KORulebqlqZu54vAlVr9xKL++aTRxXKXRjBt4yipNvFQU6L2toY1KFE2YFm /qIr4e22r4uTeG3UvgEo2HShpJMg4DtqVnBeS/uVxLT9xftkwX8+iHbWJQZOMjvXuBlWV BNSQvZwrrDoXPTKmdrXx9jFDgHnKwojS4epBYad9TmMgJxBxi6VfT3MPuJEuRvu4S9R1j OFOGtCGotjvGtjRS25C1VViqL9QbQTBPEK05Nl0pA/K9MsR1SIY3SM/CAG5vhIpL/JQ== 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="D2/sJA/9"; arc=none smtp.remote-ip=100.103.45.18 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 2EA7D606A322 for ; Thu, 3 Dec 2026 20:45:57 +0000 (UTC) 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=D2/sJA/9 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 584EF1F0092B; Thu, 3 Dec 2026 20:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796330757; bh=FyH31y5ZmkdbUBySI/CPEhIq2Go5W50/GMg29glNJO8=; h=Date:From:To:Subject; b=D2/sJA/94Pc5k/g1Preor++dtNfhjrHEF8liTBMo1dMT1efK3S2BApGpRG2Sng7rw F1nS1A61zdBS1sXHwMV5y0zFatNdOlKfgyWdGbutbko7EgTan26OxaIbwacByu8T+Z 6lrtVRiSo7xFH37D38K2EhkdVh21BVEkIX+X44VL6H9iodEg/yIrS3NnohoqFG7m7p MDVr+rhNGM10CC+I9dA0buXssZVsrN+AaZPF7ACFHxtuq0kONuqUQG/VECb8Uxpnjz O/gEBNzkrQfleqVAznRzEO8WTTsVohwO0axuCnqPmUuv4AxhTeJ+LloIeFp2o9gqiE u7LcwrVdQUGLw== Received: from stl-compute-04.internal (stl-compute-04.internal [10.204.2.64]) by mailfauth.stl.internal (Postfix) with ESMTP id 94113780043; Thu, 3 Dec 2026 15:45:56 -0500 (EST) Received: from stl-imap-13 ([10.204.2.104]) by stl-compute-04.internal (MEProxy); Thu, 03 Dec 2026 15:45:56 -0500 X-ME-Sender: X-ME-Proxy-Cause: dmFkZTEQwPbGye+VhSXH4kq4yKTGgUG4+U+yiVj+EXfefW6swAlSqwd1oevjZWwt3nCINl rFjHT4QKBRTW9c0N/A1+pVZf3s2r5VfpFC3TGfdqSz3SX8ZXtB+FjJfhrRiwdRKis3gwPM rBbHl1GmXeqRhGP91A9XtEwh+KwoudjT89RRMyaq1p2Pt4HNrQUQwPFePYpo88nFLd45UN +NT5E+EyEBgzjIJ9tH3h/hrsh4EP/84jtRXN7sRuskf4Sx1lG5HTQPFNxZXsmjRIKsdTVb jToEGfaK8+4BK3UlHkJ0bPs150g4bFzXh0UyWY1GYoWYdJHTxcFWrJ/T1Eq1VuBx2qlGdJ o345mcOc1RLnHhbTEAoDxtJk93jPFSA9HUB13JTkIkjEF8/8YM5vA4uaGNsWAQp5HA3a1H gg4cxRUwgEa381XkNtri4DVwWgdQ9DK7sHhUCZDJdbH2XGJ1Hn9Br1AgBoPs1jm+drgoOi s4wZLb2RbFFKZH7UGvVF0guiC9+PrYpvJq5ImhmHW4KP9lIJugKDWBxtMMZueJRwaQIqT3 CNqCZvXCYKsqqAcUp/lRFfmFhaREUMBy6Zi5lc+tE+padqOMp8qPBP3oJkp9KdUAVsZxg5 GJTpj6sm0IxvYCtkTdU5iCuqFOQl0xksFgB32FBdZJJ16V/WHX5l2LjIrlmQ X-ME-Proxy: Feedback-ID: iccae4b50:Fastmail Received: by mailuser.stl.internal (Postfix, from userid 501) id 538A0F60088; Thu, 3 Dec 2026 15:45:56 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-ThreadId: A6QYJzXTjw8k Date: Thu, 03 Dec 2026 15:45:36 -0500 From: "Chris Mason" To: 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@bacik.io, netdev@vger.kernel.org, mason@kernel.org Message-Id: <20261203202930.14580-1-mason@kernel.org> Subject: [PATCH net] tcp: clamp the u64 delta in tcp_rcv_rtt_measure() Content-Type: text/plain Content-Transfer-Encoding: 7bit TCP autotuning can leave the receive buffer too small if the sender takes more than 71 minutes to fill a receive window. tcp_rcv_rtt_measure() uses that time as an RTT sample, but truncates it to u32 before tcp_rcv_rtt_update() clamps it: tcp_mstamp - rcv_rtt_est.time = 4295000000 us (u32)4295000000 = 32704 us min(32704, TCP_RTT_MAX_US) = 32704 us Without TCP timestamps, autotuning keeps the smallest sample as its RTT estimate for the rest of the connection. The fix used here is to clamp the sample while it is still a u64. 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: 645f4c6f2ebd ("tcp: switch rcv_rtt_est and rcvq_space to high resolution timestamps") Signed-off-by: Chris Mason --- net/ipv4/tcp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 50c0da17923e4..0bbb0ed71469b 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -895,7 +895,7 @@ static inline void tcp_rcv_rtt_measure(struct tcp_sock *tp) goto new_measure; if (before(tp->rcv_nxt, tp->rcv_rtt_est.seq)) return; - delta_us = tcp_stamp_us_delta(tp->tcp_mstamp, tp->rcv_rtt_est.time); + delta_us = min(tp->tcp_mstamp - tp->rcv_rtt_est.time, TCP_RTT_MAX_US); if (!delta_us) delta_us = 1; tcp_rcv_rtt_update(tp, delta_us, 1); -- 2.56.0