From patchwork Tue Oct 27 13:46:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 289892 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03E42C5DF9E for ; Tue, 27 Oct 2020 14:55:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8AF722264 for ; Tue, 27 Oct 2020 14:55:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810512; bh=vIua93kvtFo6FbwlFNvkH5rwWe5WDCYlNBrQCJ7AneU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=yG144s+5xo9hJQ3AWNfsnqnb5dMHXRP++dx/E/2o7mOUfyBrD5UDLVaUoy0dFOinW oSP/ivGsHd8Yf6nf0T6uDBExMbv7WWmB0/JdqNrVmfAOKHKwJSIgKOODoNh2/scT+E 5OJ1RFRvKi6ghl7D1GrjpqRsxWi1dwV9sUsQ18lI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S368505AbgJ0Oyy (ORCPT ); Tue, 27 Oct 2020 10:54:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:49844 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1768382AbgJ0Otr (ORCPT ); Tue, 27 Oct 2020 10:49:47 -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 D7767206E5; Tue, 27 Oct 2020 14:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810187; bh=vIua93kvtFo6FbwlFNvkH5rwWe5WDCYlNBrQCJ7AneU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PIQm0SA+npM5O5z26MDEoY2PJMsoCAGftQEcDiQ5ykkUv2ZJG+ronGe10acnslRnb iol6VC+3mSdym7jYkumBUMeZyS/FhRnZWFVN+pqPz1LkqtY/1MOBHnvX8lLaI6oaVe zFHdEg4INU2HGliWXl7ud8CDK14UT4N+PANiaRBo= 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.8 052/633] tcp: fix to update snd_wl1 in bulk receiver fast path Date: Tue, 27 Oct 2020 14:46:35 +0100 Message-Id: <20201027135525.140230466@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 @@ -5716,6 +5716,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);