From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EAB63AC0E7; Fri, 9 Oct 2026 14:23:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791555795; cv=none; b=kWZOddKAfTauTsEr/TdXQjed42heWcng8MgzE72FqRF1ZM/+xNw28NgEmrgkbCr7N4nVDB7G8YbUCeEEt4ASVDItbiQMOJ22rc1YL9PorObNVDCCAIP7lJCiIsq+PX8fXwp5USWbsxvdQWPYfc/9RwrWcXt4Z+SZ+w3cM+arjX8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791555795; c=relaxed/simple; bh=Wcbtygjyzzyzib7auNcqrctXwqcTgKGeurxi7uHVNag=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qEkkdq+ge7PTjaNMkXD3C7pq7PpriEaOSgRvURtDjlZ4N8DecJa+5y/xUkUvzqQuZiaGRIAlTxTJYaBAD9/Qxs1bE1xT8lHFlIgvOIt7/PucBGZ7YYMNQzNvAsD4cbVPKCB8Z/GJLQFMmXcVeJiJgY4I01gWBW3d0pZkXWvnnSU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=03smChk9; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="03smChk9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B93F1F00893; Fri, 9 Oct 2026 14:23:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791555794; bh=RjiUN3YIUGIFztO1X9YwsSjbFIEPybEGxC7OCxlRlfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=03smChk9bN7Ztu7mriQStmHXmFEYyTXNtBsjBv0lGkdybEo3vL7o6EoKXMfddrQ65 8zxltrrpwyj83oP0Y8r4OyKXu6rVdKlEkS580qqUgRM3shsGSLWFZ8PuGML2Kuditn ZrKpUENb9pO9rOYSV9Muvi3sTqpwm7OQ0xTCEa4U= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jeff Jo , Eric Dumazet , "David S. Miller" , Sasha Levin Subject: [PATCH 6.18 119/403] tcp: refresh TS.Recent for accepted old ACKs Date: Fri, 9 Oct 2026 16:08:00 +0200 Message-ID: <20261009140954.862814925@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009140952.119038291@linuxfoundation.org> References: <20261009140952.119038291@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jeff Jo [ Upstream commit 1b92780ae4fc3be64f05d97ed8833c445e73b0cf ] A TCP packet can carry new data while acknowledging traffic in the opposite direction. With overlapping traffic in both directions, a delayed packet's acknowledgment can be older than one Linux has already accepted, even when that packet fills a gap in the received data. Linux accepts the data, but tcp_ack() takes the old_ack path and skips updating TS.Recent, the timestamp saved for outgoing acknowledgments. The reply therefore echoes an older timestamp. If the sender uses this echo to measure round-trip time after a long idle period, its estimate includes the idle time and can reduce its sending rate. Update TS.Recent in old_ack using tcp_replace_ts_recent(), before SACK processing can trigger a transmission. This reuses the existing timestamp and sequence checks, including PAWS protection against old duplicate packets. ACK validation already rejects old ACKs in SYN_RECV before this path, so no additional state check is needed. Echoing the timestamp of the packet that fills the receive gap follows RFC 7323 section 4.3. In a socket reproduction with 300 seconds idle, controlled reordering and retransmission to exercise timestamp-based RTT sampling, the sender's smoothed round-trip time was 37.5 seconds without the fix and 15.5 ms with it. Fixes: 12fb3dd9dc3c ("tcp: call tcp_replace_ts_recent() from tcp_ack()") Assisted-by: LLM sparse Signed-off-by: Jeff Jo Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/tcp_input.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index d9b07a3b93904..e1785140bf9b1 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -4204,6 +4204,12 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) return 1; old_ack: + /* An old ACK can carry new data. Update TS.Recent before SACK + * processing can trigger a retransmission. + */ + if (flag & FLAG_UPDATE_TS_RECENT) + tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq); + /* If data was SACKed, tag it and see if we should send more data. * If data was DSACKed, see if we can undo a cwnd reduction. */ -- 2.53.0