Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp80163ybt; Tue, 30 Jun 2020 15:15:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz51H8viCC0F0wZGaIgB0fqg8+NuHjUSvFUuQMVxb6BkMJsYkb+I7hWeKbNylCmjPpxztRo X-Received: by 2002:aa7:c54f:: with SMTP id s15mr26325403edr.175.1593554990534; Tue, 30 Jun 2020 15:09:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593554990; cv=none; d=google.com; s=arc-20160816; b=jQaJuMTaEY2yQETN5SMXIACtW/nBwzmbaFis0Ocx0PSvw8l29tjAlmD2BTkCdf+AV6 CDGbcHd0wejVf+XOSu65Pszs8YFBHa+lt3pPglZ6aNSb4MVQDSY3pWzKrPWdCfKFLsiw O+Gy9+Tx8uM0gw3ozmA3tYgdbbOwFeiP23NctbQ6rlOYOsffm6vWjFAYk45ZpbnELRGq q2dyvZZlX1s6nKPdLR8sHF2CtJ2u9NifoILCz/j4F83Uf3sZGQwk5i96fPS21ZA+d15E LI2gq+coWUrD0Wl6eL4IpeiN8lK/WMxHDLAyuV8Dkg3qtDzdYo/cmWtmieEzggF69szM koWw== 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=691b3xWfqIBa1A1wsIV3iMy/Zs9rJUYoT5w1uX/0Ctk=; b=lvQzgk8Yrt0is0sWTX/Kcy6ieIKJPauxzOttgdBXy0bWEYMRiYEb/Bs3U1u2Ymv0Lr rrjFV/xAHnjgW/VMJoLmYYANs4GmUyrGet91g3JB6lqCOJrYawxjpu4G74qH6uq3VxkK EOwONP7qVjWdf/kXkbfzaigN4MkuSehdepDJqElBQS0J/qjMKDHBnkswgdrLbnUEA/dG 6LNkBDCeCsKzEtiDt56RxULu29VRK5XR0EUua4aqXOY3YcHLH692kAHWMyZZ/Tk8QK1Y 7/nf1e91+iu+liwGjeu2oyN3EI9+Yd9JGzsQO4ED2nkAdyFfYygMrl0S1ZKze5rb3PDv xxjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=W96sXiTM; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si2534992edr.106.2020.06.30.15.09.27; Tue, 30 Jun 2020 15:09:50 -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=@google.com header.s=20161025 header.b=W96sXiTM; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726300AbgF3WHV (ORCPT + 99 others); Tue, 30 Jun 2020 18:07:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726074AbgF3WHV (ORCPT ); Tue, 30 Jun 2020 18:07:21 -0400 Received: from mail-yb1-xb42.google.com (mail-yb1-xb42.google.com [IPv6:2607:f8b0:4864:20::b42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB86FC03E979 for ; Tue, 30 Jun 2020 15:07:20 -0700 (PDT) Received: by mail-yb1-xb42.google.com with SMTP id e197so6857029yba.5 for ; Tue, 30 Jun 2020 15:07:20 -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=691b3xWfqIBa1A1wsIV3iMy/Zs9rJUYoT5w1uX/0Ctk=; b=W96sXiTMhMyQM40ezkwKcWl+p3JTm44BhAl41PNAbXajbsh/879d3cx2+T9sAzP+XT JInNu1eWE2g6KkBE9tWdwMFUn4Pb3EcbVu481NVBBPvKEyHQ9QoxwM5YglPpX6lXnIa2 pCX/l1f+52YbVGxWAoTB0TLJ7xIOrob1omaNexPwajinFg79X46+HciWQip+quBCUA7d 7Wn6PSer4JQVFVWgV6S5CbxtVzbWXivtUynxAMqr83qN0NCEdJYl1utckMyy6yd37CC2 q3lAflfTPwKgL9c2XUdrhu/z1niqzutO7Ohw/g9g029a+f9PrqJeiB3eBWejrqvRHozr Ntbg== 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=691b3xWfqIBa1A1wsIV3iMy/Zs9rJUYoT5w1uX/0Ctk=; b=GTI/FNg0Fl67T9epGzDswSdxBmFi4JaNv9ZTnaPWRgtW4CI7tSRv8SCfBIj1A2IsIw 1/JAu04soFpVkaMaqFgcuJd22Q7E/qGc65lZ1Czq5p2auUEH9JdBakom1ZsQ/kX7WkN0 JppZlnTImcMA90WazsFigEr0GvrgGEI36wQDha0O6I/7blm1gOUI5ujt0aHF5RVeeTWa 58QCO9vkoRcCAN9n46TkLjHXIv00aKj9K9x+31izn19uKHv900hn4gIBp+3UB9A9M7oM +Z8LEQq/zu9sT9YWvG7bC3tijxh1HJlHT+CCROg9uUo4ZdCkwGM5iAb0IV5eN3GKyoPb NOmA== X-Gm-Message-State: AOAM530bBmITA7roXCdFvSccgzz43WvjJVNXsPbNP+t/OAy7I0Xs81RX nI27yb9JH9bmFUfsclyTihzHRJxmWdfAuxyKp7JByw== X-Received: by 2002:a25:ec0d:: with SMTP id j13mr35035984ybh.364.1593554839938; Tue, 30 Jun 2020 15:07:19 -0700 (PDT) MIME-Version: 1.0 References: <312079189.17903.1593549293094.JavaMail.zimbra@efficios.com> <20200630.134429.1590957032456466647.davem@davemloft.net> <474095696.17969.1593551866537.JavaMail.zimbra@efficios.com> In-Reply-To: From: Eric Dumazet Date: Tue, 30 Jun 2020 15:07:08 -0700 Message-ID: Subject: Re: [regression] TCP_MD5SIG on established sockets To: Mathieu Desnoyers Cc: "David S. Miller" , Linus Torvalds , linux-kernel , netdev , Yuchung Cheng , Jonathan Rajotte-Julien 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 Tue, Jun 30, 2020 at 2:54 PM Eric Dumazet wrote: > > On Tue, Jun 30, 2020 at 2:23 PM Eric Dumazet wrote: > > > > On Tue, Jun 30, 2020 at 2:17 PM Mathieu Desnoyers > > wrote: > > > > > > ----- On Jun 30, 2020, at 4:56 PM, Eric Dumazet edumazet@google.com wrote: > > > > > > > On Tue, Jun 30, 2020 at 1:44 PM David Miller wrote: > > > >> > > > >> From: Eric Dumazet > > > >> Date: Tue, 30 Jun 2020 13:39:27 -0700 > > > >> > > > >> > The (C) & (B) case are certainly doable. > > > >> > > > > >> > A) case is more complex, I have no idea of breakages of various TCP > > > >> > stacks if a flow got SACK > > > >> > at some point (in 3WHS) but suddenly becomes Reno. > > > >> > > > >> I agree that C and B are the easiest to implement without having to > > > >> add complicated code to handle various negotiated TCP option > > > >> scenerios. > > > >> > > > >> It does seem to be that some entities do A, or did I misread your > > > >> behavioral analysis of various implementations Mathieu? > > > >> > > > >> Thanks. > > > > > > > > Yes, another question about Mathieu cases is do determine the behavior > > > > of all these stacks vs : > > > > SACK option > > > > TCP TS option. > > > > > > I will ask my customer's networking team to investigate these behaviors, > > > which will allow me to prepare a thorough reply to the questions raised > > > by Eric and David. I expect to have an answer within 2-3 weeks at most. > > > > > > Thank you! > > > > > > Great, I am working on adding back support for (B) & (C) by the end of > > this week. > > Note that the security issue (of sending uninit bytes to the wire) has > been independently fixed with [1] > > This means syzbot was able to have MD5+TS+SACK ~6 months ago. > > It seems we (linux) do not enable this combination for PASSIVE flows, > (according to tcp_synack_options()), > but for ACTIVE flows we do nothing special. > > So maybe code in tcp_synack_options() should be mirrored to > tcp_syn_options() for consistency. > (disabling TS if both MD5 and SACK are enabled) Oh well, tcp_syn_options() is supposed to have the same logic. Maybe we have an issue with SYNCOOKIES (with MD5 + TS + SACK) Nice can of worms. > > [1] > > commit 9424e2e7ad93ffffa88f882c9bc5023570904b55 > Author: Eric Dumazet > Date: Thu Dec 5 10:10:15 2019 -0800 > > tcp: md5: fix potential overestimation of TCP option space > > Back in 2008, Adam Langley fixed the corner case of packets for flows > having all of the following options : MD5 TS SACK > > Since MD5 needs 20 bytes, and TS needs 12 bytes, no sack block > can be cooked from the remaining 8 bytes. > > tcp_established_options() correctly sets opts->num_sack_blocks > to zero, but returns 36 instead of 32. > > This means TCP cooks packets with 4 extra bytes at the end > of options, containing unitialized bytes. > > Fixes: 33ad798c924b ("tcp: options clean up") > Signed-off-by: Eric Dumazet > Reported-by: syzbot > Acked-by: Neal Cardwell > Acked-by: Soheil Hassas Yeganeh > Signed-off-by: David S. Miller > > diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c > index be6d22b8190fa375074062032105879270af4be5..b184f03d743715ef4b2d166ceae651529be77953 > 100644 > --- a/net/ipv4/tcp_output.c > +++ b/net/ipv4/tcp_output.c > @@ -755,8 +755,9 @@ static unsigned int tcp_established_options(struct > sock *sk, struct sk_buff *skb > min_t(unsigned int, eff_sacks, > (remaining - TCPOLEN_SACK_BASE_ALIGNED) / > TCPOLEN_SACK_PERBLOCK); > - size += TCPOLEN_SACK_BASE_ALIGNED + > - opts->num_sack_blocks * TCPOLEN_SACK_PERBLOCK; > + if (likely(opts->num_sack_blocks)) > + size += TCPOLEN_SACK_BASE_ALIGNED + > + opts->num_sack_blocks * TCPOLEN_SACK_PERBLOCK; > } > > return size;