Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp381291pxx; Wed, 28 Oct 2020 07:07:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwVEfYPdN20irTNLmCLqm4PD1ZDf+CKCyP+Sxy5aBkY0avqFVqmOTnqCGkCyvqTwVdVnRc X-Received: by 2002:a17:906:3641:: with SMTP id r1mr8028313ejb.391.1603894076090; Wed, 28 Oct 2020 07:07:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603894076; cv=none; d=google.com; s=arc-20160816; b=ULk9i8FOEE2EmPH+QnwJjUzF3YB3FQkR9eIhxLt2UsVA9eolbOxT5ypHY7dCvnKow0 P0DbgHF5WODU3gxP0vZUMrOsYYKi7Hj5FLTpJzMyUGh7L1yN4gzZ2SXQPTluKMfiLMRg 9Yx/RDN6X9JBTJ7VT7skI/Qkhw+WeNSShm+mjRGu1a2g2U4UUw5q49ZXIpFponee2Qhf I/GqVW46fxJsvvHex0Ek0vh0rjoJADXxzTmGFR2MToGktHBDjXiqFDNjVDXjaomZxZN7 1M54bSwmd20FBzyt8BQELfK3MwFMr6F0mOtp7+mGAEcYek7V1uPJ88qCn7JSFbylLO+2 JHSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TGjkPIEtPn/XPSfP/CSE11mzbkt2iX3fTXqMOJLslok=; b=skNml1lEoQrkIijP+5/rZGo78PZ23bVWi5xpZKK/t6weN1zSccfiGgzjSKpUFjcf+P M7kJUdrZHlp62PGFkaFPdXLHgrhm2jgUjTe014sSLdcwrn0JObOSYScdQYUw30gqsaNX PHq+PWxWOdnJIjC7mZmXNrO50f61b9437r+3205L5Kxa0ne/zS+GBydKKhOY3VgDI/ib zg8ZXD0zQtRxUlvk6ekZu457XTrV9Q3Ztpj2avsqEyB+wlkc6H9PktY3eIyyYR5Eao8O 7Pr6N+xq6j1trrN4M2oE+aEAH7mimiADG6PbQ2iDJsyLBlhaDL4ZVQafRrOQnBPrKsOT menQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yOrIvO7v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs17si3022913ejb.543.2020.10.28.07.07.33; Wed, 28 Oct 2020 07:07:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yOrIvO7v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1804005AbgJ0Pxi (ORCPT + 99 others); Tue, 27 Oct 2020 11:53:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:59280 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1796598AbgJ0PTo (ORCPT ); Tue, 27 Oct 2020 11:19:44 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A2E992064B; Tue, 27 Oct 2020 15:19:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811983; bh=XZ7rIa5DuVwkBrTk/BZ0eU7TQQYdRzSQ2xPrn5uyWzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yOrIvO7vZPHbDKeb5mqSmcpcF+5dp+oLh0EGxcmbFbZisLKMMJF/zWov4ANb9lqnN 2DzfxzuTflFDzzNZCzELKfgrkD5Bu6EReNEg87CDyiLPGG/znFs0g3ficMdeQvKOVv a8bnF+LBzh7tnT1Byly/pa9T+BsVlQzgUA/D4f9g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neal Cardwell , Apollon Oikonomopoulos , Soheil Hassas Yeganeh , Yuchung Cheng , Eric Dumazet , Jakub Kicinski Subject: [PATCH 5.9 052/757] tcp: fix to update snd_wl1 in bulk receiver fast path Date: Tue, 27 Oct 2020 14:45:02 +0100 Message-Id: <20201027135452.997529528@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Neal Cardwell [ Upstream commit 18ded910b589839e38a51623a179837ab4cc3789 ] In the header prediction fast path for a bulk data receiver, if no data is newly acknowledged then we do not call tcp_ack() and do not call tcp_ack_update_window(). This means that a bulk receiver that receives large amounts of data can have the incoming sequence numbers wrap, so that the check in tcp_may_update_window fails: after(ack_seq, tp->snd_wl1) If the incoming receive windows are zero in this state, and then the connection that was a bulk data receiver later wants to send data, that connection can find itself persistently rejecting the window updates in incoming ACKs. This means the connection can persistently fail to discover that the receive window has opened, which in turn means that the connection is unable to send anything, and the connection's sending process can get permanently "stuck". The fix is to update snd_wl1 in the header prediction fast path for a bulk data receiver, so that it keeps up and does not see wrapping problems. This fix is based on a very nice and thorough analysis and diagnosis by Apollon Oikonomopoulos (see link below). This is a stable candidate but there is no Fixes tag here since the bug predates current git history. Just for fun: looks like the bug dates back to when header prediction was added in Linux v2.1.8 in Nov 1996. In that version tcp_rcv_established() was added, and the code only updates snd_wl1 in tcp_ack(), and in the new "Bulk data transfer: receiver" code path it does not call tcp_ack(). This fix seems to apply cleanly at least as far back as v3.2. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Neal Cardwell Reported-by: Apollon Oikonomopoulos Tested-by: Apollon Oikonomopoulos Link: https://www.spinics.net/lists/netdev/msg692430.html Acked-by: Soheil Hassas Yeganeh Acked-by: Yuchung Cheng Signed-off-by: Eric Dumazet Link: https://lore.kernel.org/r/20201022143331.1887495-1-ncardwell.kernel@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_input.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5766,6 +5766,8 @@ void tcp_rcv_established(struct sock *sk tcp_data_snd_check(sk); if (!inet_csk_ack_scheduled(sk)) goto no_ack; + } else { + tcp_update_wl(tp, TCP_SKB_CB(skb)->seq); } __tcp_ack_snd_check(sk, 0);