Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp394879ybd; Tue, 25 Jun 2019 23:40:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqzyJNqeaN3ie8UIWHkfB21897boFys6A0mNHQy1gAh98EOWtDeHVZgITjF3NjfE25pNd2aX X-Received: by 2002:a17:90a:376f:: with SMTP id u102mr2763224pjb.5.1561531210522; Tue, 25 Jun 2019 23:40:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561531210; cv=none; d=google.com; s=arc-20160816; b=VD8wxGqI2/CiugwTWmj7cyjWPwaZb1nSrVJONG4KYN0MdN1YY1uH/Bt/SgKiWpE9Zi IC9JTp2ENVNG4hns07HuoxjMf4fiGYUde0Uw2qcNYuwXujDcpgbFPfTssgq0bw0birAK a3j3dRzxIl0d5rtRP8f7fTbEvq2aaKbZSobkHSpYdQfCGoDRckhr61oJZZKBygJPu6KP ZenDYFDUF85xJ8c1rBkKFdzGMEdOxU7Y3O1CPNrxKEtmg+5G9UPbTHRqgYwMpDCrgbva fHamjw13wTO6gPQ0ZTJJhhDrnGCCCQLLg+bk8T7NRlJO03oz8I5OPtdLOSZk2hNa4wA+ ZcKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=z4FZnEaViYUU/TWmZUmNfIjzU53EGW1PnwT6ZSxC/SA=; b=USCD5tBot9qPKi9PZe37R+EL8BCl7xAtiPWXLqx6dXB/IvlLGhlgbgcHhC0XndndA3 H/b9xIlb3LguV9V/c9lEe1rBqxqf7VVoYxIfVUPk1kYs1BOBEENXnyKX8kEwYY1hUaEO IBvZokLVRwjNlmaMTnqFb1PZ+B9XdAS79eNfaTEd5ZZ5rrepnFslHjEw/fjUniBpecYd K35SJ27W4M56XvGT1iExRqwqNkcGy8j48ucdTCaIO7Rvr8LgHRhaqocImfPx1axLM6W7 lyG8EC+EvWr5CkSWx+63fXAWibpBQYHl4GiEj+tua8zFmdlehUSutN5rmpG77J90UZX5 Iahg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="UHOfHR/y"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64si2491032pld.334.2019.06.25.23.39.46; Tue, 25 Jun 2019 23:40:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="UHOfHR/y"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726789AbfFZGiP (ORCPT + 99 others); Wed, 26 Jun 2019 02:38:15 -0400 Received: from mail-yb1-f193.google.com ([209.85.219.193]:38986 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725876AbfFZGiO (ORCPT ); Wed, 26 Jun 2019 02:38:14 -0400 Received: by mail-yb1-f193.google.com with SMTP id k4so752715ybo.6 for ; Tue, 25 Jun 2019 23:38:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=z4FZnEaViYUU/TWmZUmNfIjzU53EGW1PnwT6ZSxC/SA=; b=UHOfHR/yyYIeMiULopgaiCu/bXxHSR2ChCuN98T0SpjOqVQPSkulXcRjWJKQaNFGHA g9iKxPFpYy9czx9tqXirKOwZNgmqaCNYdP0fb0J3SraKhnlslaVtjMru8bcp+FP1XUh+ z2vZzejtafGJH8CAzl0+WM5+KNovJpX59nKKwmdXb7cP33VEJGrMWuHNh7sunRBjva8/ JVia+3TheMRcalXsDIdCCZqm9jF9STPbhJek6V3pBUp1zh1fJWD7j67UVb0ieDhuGmCY v1bWvNb9Kt2G81eab+K4i4Nuw0RmCeqJiw2b6G6j/mG6rjNQyuqzyj80SGSW7nAsqN9y TpzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=z4FZnEaViYUU/TWmZUmNfIjzU53EGW1PnwT6ZSxC/SA=; b=r+f0sXflo4DiXVBiqmraU2KAcDQIA1IGlV6XaYHe5y/L8NLp9rpHzSr3QabKanLYAW gGrxEmWj/5tojvGWaclhr/LQy+G1Ecik2XMGvNziNfNZNmiFKuGfGZK+vT1iLINllDK8 IBUWk8v2abyvt+bcVfy9snYWTuUmuQ2thDCOVW24xh5hxLfPuq6ZL4EoU+/I0Phn2YWo 7pDNNS76OjQpXM3RMgY3mAvSk2jlbgTy65glipqHaMAXdk0Gi5TzcB43dhmVb+HHZGIF ZqLqGyeRTMn3RuNzHfc4yvPLML1z3YdQ/L4v0YJn6LoCIqiokMVuNjkF+CrNmsM3EGEG PykQ== X-Gm-Message-State: APjAAAUaTBOLUAFmaFSaBtw/yhXAZGOrXmMN00XR7Qg3Ru0P6DhLsHdJ gX6Xin/q86qbgp316n98KaG66qye81aOmbfwQH27mhnw8ITdr99m X-Received: by 2002:a25:7057:: with SMTP id l84mr1589239ybc.518.1561531093008; Tue, 25 Jun 2019 23:38:13 -0700 (PDT) MIME-Version: 1.0 References: <20190622073753.GA10516@kroah.com> <20190626020220.GA22548@roeck-us.net> <20190626022923.GA14595@kroah.com> <53b23451-f45b-932d-a2f8-15f74f07a849@roeck-us.net> <20190626051720.GA575@kroah.com> In-Reply-To: <20190626051720.GA575@kroah.com> From: Eric Dumazet Date: Wed, 26 Jun 2019 08:38:01 +0200 Message-ID: Subject: Re: Steam is broken on new kernels To: Greg Kroah-Hartman Cc: Guenter Roeck , Linus Torvalds , "Pierre-Loup A. Griffais" , lkml Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 26, 2019 at 8:22 AM Greg Kroah-Hartman wrote: > > On Wed, Jun 26, 2019 at 06:20:17AM +0200, Eric Dumazet wrote: > > On Wed, Jun 26, 2019 at 5:43 AM Guenter Roeck wrote: > > > > > > On 6/25/19 7:29 PM, Greg Kroah-Hartman wrote: > > > > On Tue, Jun 25, 2019 at 07:02:20PM -0700, Guenter Roeck wrote: > > > >> Hi Greg, > > > >> > > > >> On Sat, Jun 22, 2019 at 09:37:53AM +0200, Greg Kroah-Hartman wrote: > > > >>> On Fri, Jun 21, 2019 at 10:28:21PM -0700, Linus Torvalds wrote: > > > >>>> On Fri, Jun 21, 2019 at 6:03 PM Pierre-Loup A. Griffais > > > >>>> wrote: > > > >>>>> > > > >>>>> I applied Eric's path to the tip of the branch and ran that kernel and > > > >>>>> the bug didn't occur through several logout / login cycles, so things > > > >>>>> look good at first glance. I'll keep running that kernel and report back > > > >>>>> if anything crops up in the future, but I believe we're good, beyond > > > >>>>> getting distros to ship this additional fix. > > > >>>> > > > >>>> Good. It's now in my tree, so we can get it quickly into stable and > > > >>>> then quickly to distributions. > > > >>>> > > > >>>> Greg, it's commit b6653b3629e5 ("tcp: refine memory limit test in > > > >>>> tcp_fragment()"), and I'm building it right now and I'll push it out > > > >>>> in a couple of minutes assuming nothing odd is going on. > > > >>> > > > >>> This looks good for 4.19 and 5.1, so I'll push out new stable kernels in > > > >>> a bit for them. > > > >>> > > > >>> But for 4.14 and older, we don't have the "hint" to know this is an > > > >>> outbound going packet and not to apply these checks at that point in > > > >>> time, so this patch doesn't work. > > > >>> > > > >>> I'll see if I can figure anything else later this afternoon for those > > > >>> kernels... > > > >>> > > > >> > > > >> I may have missed it, but I don't see a fix for the problem in > > > >> older stable branches. Any news ? > > > >> > > > >> One possibility might be be to apply the part of 75c119afe14f7 which > > > >> introduces TCP_FRAG_IN_WRITE_QUEUE and TCP_FRAG_IN_RTX_QUEUE, if that > > > >> is acceptable. > > > > > > > > That's what people have already discussed on the stable mailing list a > > > > few hours ago, hopefully a patch shows up soon as I'm traveling at the > > > > moment and can't do it myself... > > > > > > > > > > Sounds good. Let me know if nothing shows up; I'll be happy to do it > > > if needed. > > > > > > Without the rb-tree for rtx queues, old kernels are vulnerable to SACK > > attacks if sk_sndbuf is too big, > > so I would simply add a cushion in the test, instead of trying to > > backport an illusion of the rb-tree fixes. > > > > > > > > diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c > > index a8772e11dc1cb42d4319b6fc072c625d284c7ad5..a554213afa4ac41120d781fe64b7cd18ff9b56e8 > > 100644 > > --- a/net/ipv4/tcp_output.c > > +++ b/net/ipv4/tcp_output.c > > @@ -1274,7 +1274,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff > > *skb, u32 len, > > if (nsize < 0) > > nsize = 0; > > > > - if (unlikely((sk->sk_wmem_queued >> 1) > sk->sk_sndbuf)) { > > + if (unlikely((sk->sk_wmem_queued >> 1) > sk->sk_sndbuf + 131072)) { > > NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPWQUEUETOOBIG); > > return -ENOMEM; > > } > > That's a funny magic number, can we document what it means? This is because TCP can cook skb with about 64KB of payload in tcp_sendmsg() before checking if memory limits are exceeded. (This is mentioned in commit b6653b3629e5b88202be3c9abc44713973f5c4b4 " tcp: refine memory limit test in tcp_fragment()" changelog) Then, if this giant TSO skb needs to be split in ~45 smaller skbs of one segment each, the resulting truesize might be twice bigger. You could use 2 * 65536 if that looks better, and possibly a macro, but I feel that adding a macro for this one particular spot and stable kernels might be overkill ? > > And yes, it's a much simpler patch, I'd rather take this than the fake > backport.