From mboxrd@z Thu Jan 1 00:00:00 1970 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=-14.6 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL 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 4E2A9C433DF for ; Tue, 30 Jun 2020 22:07:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F5C420829 for ; Tue, 30 Jun 2020 22:07:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="W96sXiTM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726319AbgF3WHV (ORCPT ); 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-Google-Smtp-Source: ABdhPJzkTS1NFp9xnWmvdli40oBisekjgROtD4WCRD1u3n3F6Pj+65dZ+aHyhk2C+MrAMHUg/GQrEl59+6qXz/hixL8= 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;