Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1227034pxx; Tue, 27 Oct 2020 11:12:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNCGvUaM9DQAHWd5YsBVWFtaL0NIh2Tot/kjmURZ9RUQgUDL/r+L8kxTVGEUid3S9oMznP X-Received: by 2002:a17:906:3bc7:: with SMTP id v7mr3519648ejf.245.1603822364246; Tue, 27 Oct 2020 11:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603822364; cv=none; d=google.com; s=arc-20160816; b=K/43H1po8opI2R4/IF/Hu8fD+RjpW9i+Qa+CHhL6WiesKauxVuXj7kFzVQ5CCuuXYn 9A1kSIDowVzZOdAxVBwESNbo6g6YGLXTTbtviZI1mM9zMGwKRNvzDXmkS8fBT0Eb0kOt CbsBj9wjHBcM/+CXdhWy9ggLMBPfNVnhGzJTWJJ2fqzUsfPwWMnxlythcWbFwwLpWwCm aItfvm2XB7N+CobEPYJAT2SRnsaWm2uWyvHcNaUNr+bRJEYN+elApglhBdD38A8ctvNL WvM8DCDCELYXJ/axbd8KOLZ9cXnr/7cQT0XKYmHpa1yB17ZXL4lyV0YTO1nsfWkuRryi a7lg== 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=YiiDRLD1m/9cidInEmafoQG9/SKxr4G2Y0kh32eCGKo=; b=HUj/6M6NpcqWFlN7yIKgQhPI2C3/yoC3xmYO7p/kXB+4/qyZ5clKYb4EBD/6xuOCZt idZnx1ZUNdKoYeqXFrfr7IvOqvcYqF45LiH7r9rWr1iOSk/OhUYEegY70zfmCM7I2/Z5 OBYdOjQnieQYUemHxLdbJRtV9eAgTUhgQXgkr/Bh7nQjycEkUvNEqK2tcNK8MrzdUukr o8udavv5/ELCdT5Woaf8fEtk68uQRBpyIuewt3nRz/w7HxM0cXT+G7udp6rBzdOHwgm6 nR1sF8+p77eXesQRJWrSAgvwlHO48NfUiBXKuXstJvuuDYMWUKQl8s7YDbFZMAF8wkVy jYzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="BM/+ggKf"; 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 l12si1416342edw.449.2020.10.27.11.12.22; Tue, 27 Oct 2020 11:12:44 -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="BM/+ggKf"; 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 S2902186AbgJ0ObP (ORCPT + 99 others); Tue, 27 Oct 2020 10:31:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:56708 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759381AbgJ0OaC (ORCPT ); Tue, 27 Oct 2020 10:30:02 -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 3718F20780; Tue, 27 Oct 2020 14:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809001; bh=UPyzZ55L80cQhh6XJs2VD8+HKlxsoXxUHr+Gooe2Ltg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BM/+ggKfeVZLwTuf87C7EtJI4tp0vUXgoB5pq74T7j0YJVOfH7WwZNupLo3fBrbL4 zc2lVDfbdh8099/0yzHKWwr8mKWvl67naJSQPVivsZI925thqNUeLo2NiqHbBE7kmm COGQo2cTqhMK+/3KUtZo4PrO+/1JnBi/FL002mhE= 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.4 039/408] tcp: fix to update snd_wl1 in bulk receiver fast path Date: Tue, 27 Oct 2020 14:49:37 +0100 Message-Id: <20201027135456.890580942@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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 @@ -5696,6 +5696,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);