From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C877718FC8F; Wed, 3 Jul 2024 11:24:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720005877; cv=none; b=npRzlE0ljbJ7/8/X5qjmsURBLsRLhK8IeSFPYb3+q9GlrBQhdOBU6VGoaLLsymNwowIjmtNEEbbR0CYAtqkh+INCgpA0DxpWksQWWRYM/U0G640x+4YoSvXvuQzA2KxMHB4uGWXn92erFu2VF9OkoH1WxMUljvrPUtD333NrCGw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720005877; c=relaxed/simple; bh=g8nivP6HH+AAm6eGCRmV0Wmv+6rfpPx2sPwdPRhX4DA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TNOEBWrJjrBdhFuS7UFS3bpF7CXRPCjLlReNNxJDN7KsnNFQq305WjDZ81GncJrYZPnf6o75X66MAtKzqRzTQEirlIjwlgaKKkFRDy6VtQHLo+Jsasqu7HtVWltoiNyFAP7YtmnUHmJeOT/xaZr5ltwubbymrJAiwQKIZymhde0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=K879pY+9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="K879pY+9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45A3AC4AF0C; Wed, 3 Jul 2024 11:24:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1720005877; bh=g8nivP6HH+AAm6eGCRmV0Wmv+6rfpPx2sPwdPRhX4DA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K879pY+9Ty6bBhYmeJ1C08iuy+yLHC/56pJiFSoNp/YqETRTVtsMRG5Oa4YcG0lNA CPlm3mBSZ/Cl0t5eW0UwjGwd9i2KHIPRQ37qppzWRMEQrUVhZQH094kJEzO09w3X1D ymgTEvuTeeOU4ctd3Nsldi6ZUPkC+Kem+PjrFMCo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Neal Cardwell , Yuchung Cheng , Eric Dumazet , Jakub Kicinski Subject: [PATCH 5.15 227/356] tcp: clear tp->retrans_stamp in tcp_rcv_fastopen_synack() Date: Wed, 3 Jul 2024 12:39:23 +0200 Message-ID: <20240703102921.702005708@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240703102913.093882413@linuxfoundation.org> References: <20240703102913.093882413@linuxfoundation.org> User-Agent: quilt/0.67 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 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet commit 9e046bb111f13461d3f9331e24e974324245140e upstream. Some applications were reporting ETIMEDOUT errors on apparently good looking flows, according to packet dumps. We were able to root cause the issue to an accidental setting of tp->retrans_stamp in the following scenario: - client sends TFO SYN with data. - server has TFO disabled, ACKs only SYN but not payload. - client receives SYNACK covering only SYN. - tcp_ack() eats SYN and sets tp->retrans_stamp to 0. - tcp_rcv_fastopen_synack() calls tcp_xmit_retransmit_queue() to retransmit TFO payload w/o SYN, sets tp->retrans_stamp to "now", but we are not in any loss recovery state. - TFO payload is ACKed. - we are not in any loss recovery state, and don't see any dupacks, so we don't get to any code path that clears tp->retrans_stamp. - tp->retrans_stamp stays non-zero for the lifetime of the connection. - after first RTO, tcp_clamp_rto_to_user_timeout() clamps second RTO to 1 jiffy due to bogus tp->retrans_stamp. - on clamped RTO with non-zero icsk_retransmits, retransmits_timed_out() sets start_ts from tp->retrans_stamp from TFO payload retransmit hours/days ago, and computes bogus long elapsed time for loss recovery, and suffers ETIMEDOUT early. Fixes: a7abf3cd76e1 ("tcp: consider using standard rtx logic in tcp_rcv_fastopen_synack()") CC: stable@vger.kernel.org Co-developed-by: Neal Cardwell Signed-off-by: Neal Cardwell Co-developed-by: Yuchung Cheng Signed-off-by: Yuchung Cheng Signed-off-by: Eric Dumazet Link: https://lore.kernel.org/r/20240614130615.396837-1-edumazet@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_input.c | 1 + 1 file changed, 1 insertion(+) --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -6104,6 +6104,7 @@ static bool tcp_rcv_fastopen_synack(stru skb_rbtree_walk_from(data) tcp_mark_skb_lost(sk, data); tcp_xmit_retransmit_queue(sk); + tp->retrans_stamp = 0; NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFASTOPENACTIVEFAIL); return true;