Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp669803pxb; Fri, 22 Apr 2022 08:56:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFCmMKCRkdQVOTdfCTV/UrRnKoqXIn3njq26y+5Tr/VKOyY5jZiQ0ZWgNYYaJqxEOksPgU X-Received: by 2002:a05:6402:34cd:b0:424:793:9f65 with SMTP id w13-20020a05640234cd00b0042407939f65mr5573019edc.88.1650642989876; Fri, 22 Apr 2022 08:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650642989; cv=none; d=google.com; s=arc-20160816; b=Eb9Dpg+4YM1G+0sM7VYZeimIzNvT/uMKF1AC7cne+o7Ocu7jpVPlcNfZLcFmoWKvLf sQClEiCM9h3atkVFUK6Nv8JLEzoqvbiwVgs/V1ljpdX8+51XJ/N91Dm7HE2yRjq55tfl SetXeVxCiipnc0s1SVnniTjqzPSYgQR/TDQsP/txigONWPCKlqyz/7fJaCDT1CFIkWil 2Zb7mqYMcP8fGf86vtMcr4DDr+Jzw3cOq/3A9SVaLxJSABmqQh0WxNcWQhafOSPYxWH4 +EbbNQ6E5kQmf6AKFlv3j0wT8M4jm2R8LBES6RvVsGV8HQ/lIe8DnJFpsp/FnfxGxBS4 g6jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=OXocRW4Fcy3ODLwlLZMAvoG6TfyjzPBLt8Rv4un+YTQ=; b=kbMP26cRH4djkQW7iDHtizdqDCbo25+JuqnjWcPWv7BZ2qvkVEHLODhcJG0QE63T2A T/Wk9BdRz0wHYKJWpWanhe8if0hGz5UvBeM4kY3R/8zNyfYDxnKYV2wvg+qTv2GBvl9i ZVP29bZMQ/5/E6bHlI26dFmSUvIHBF5H8PQG9AYQuCQE5yDwVYvBfqcQrI32tC3bqPEV MBo3GlJrBwI2GvLYNZ4XeGgQJ+1UueKqJDSyDd0oEuMcEXL8pPxAjVFzvSdfc6LwcEK0 WDDYbPxkSzrSpPq+PmepQ+2zxeQP2EWWRzcUfG9Ltg2yFJ9KlVbkZUp0fOkswfJMnNa+ uUNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=nImhtQPJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k21-20020a170906971500b006dfad220facsi6419324ejx.474.2022.04.22.08.56.05; Fri, 22 Apr 2022 08:56:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=nImhtQPJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232390AbiDUAXg (ORCPT + 99 others); Wed, 20 Apr 2022 20:23:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232084AbiDUAXf (ORCPT ); Wed, 20 Apr 2022 20:23:35 -0400 Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD20C1A078 for ; Wed, 20 Apr 2022 17:20:47 -0700 (PDT) Received: by mail-yb1-xb2c.google.com with SMTP id p65so5825156ybp.9 for ; Wed, 20 Apr 2022 17:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OXocRW4Fcy3ODLwlLZMAvoG6TfyjzPBLt8Rv4un+YTQ=; b=nImhtQPJaOzP6XFyaGqECd5mDgHxWmDJRHdRNv+vEPa5JrDA9N7SPydqUH64Gq+hQV NtKuBALzWwwJkFIUXcbefjATqKncxCcqE2gX6X1+ZCEZp3/XoRyFVN3C+Ql4w+nDRuew q6TLmIqM0Dxfyp8AT8r4nBE3K28zycciwtrU9VM57sjM9jTtjOhzemgs1/LE7uhaTLj2 NpaCFLd0cB6ZAvRcmI1b3nMSA5ulnNKoCmrGmxz11LR8/9BTE6vVDc9Y6RCpAcN8qZvl pAleeywzdXr1/wUhp8ubkefmyj0HuspW7uuqu7SdBu71UNDDY249sR3lJuwbxG1GMs/P PlYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OXocRW4Fcy3ODLwlLZMAvoG6TfyjzPBLt8Rv4un+YTQ=; b=5qEyE/lAvCqVsf3rbQS40aihDfAPWGYgW6eqoH1EC44GeOebhcFJWN6DDS4BGSWKqK E5TlzsC6rf15ljDSs1qDpCxeKLRUVzVr8Aq6HcrBrqSR4z0F5d8UbnbNb+2wVvhjS4VN FA1JcWgV3Jg71AMG7BakQPHTG4oMJY+euEleCl05BmRWINIxj+qIPvnFa6LinQEUjbNc 9OBAffWT/GlAYiuLZ3PKgjkYh2rMhfdC2At1C5VhoEPPHEKk29SzOeDMpSBQLDlNmxm5 KQZJgi/20f0FuadB/70K9loFkvr9rK408QnLHSeQgmB9Qcgr96EtkNqacaJxkuHeOyU+ OwNw== X-Gm-Message-State: AOAM532kkeM0+GpPgZaeA+NShTq3/+FKKNlkdMerKRRjp38vbDg8Nb0Q MWhaseK0mRq5M59aNHGghMLZI5JjqCQF24sWi7p6NLy7zTzJaRyt X-Received: by 2002:a05:6902:1109:b0:645:58e:a373 with SMTP id o9-20020a056902110900b00645058ea373mr18145423ybu.231.1650500446691; Wed, 20 Apr 2022 17:20:46 -0700 (PDT) MIME-Version: 1.0 References: <20220420235659.830155EC021C@us226.sjc.aristanetworks.com> In-Reply-To: <20220420235659.830155EC021C@us226.sjc.aristanetworks.com> From: Eric Dumazet Date: Wed, 20 Apr 2022 17:20:35 -0700 Message-ID: Subject: Re: [PATCH] tcp: md5: incorrect tcp_header_len for incoming connections To: Francesco Ruggeri Cc: Paolo Abeni , Jakub Kicinski , David Ahern , Hideaki YOSHIFUJI , David Miller , LKML , netdev Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 20, 2022 at 4:57 PM Francesco Ruggeri wrote: > > In tcp_create_openreq_child we adjust tcp_header_len for md5 using the > remote address in newsk. But that address is still 0 in newsk at this > point, and it is only set later by the callers (tcp_v[46]_syn_recv_sock). > Use the address from the request socket instead. > Nice catch. This seems like a day-0 bug, right ? Do you agree on adding Fixes: cfb6eeb4c860 ("[TCP]: MD5 Signature Option (RFC2385) support.") Thanks. > Signed-off-by: Francesco Ruggeri > --- > net/ipv4/tcp_minisocks.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c > index 6366df7aaf2a..6854bb1fb32b 100644 > --- a/net/ipv4/tcp_minisocks.c > +++ b/net/ipv4/tcp_minisocks.c > @@ -531,7 +531,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, > newtp->tsoffset = treq->ts_off; > #ifdef CONFIG_TCP_MD5SIG > newtp->md5sig_info = NULL; /*XXX*/ > - if (newtp->af_specific->md5_lookup(sk, newsk)) > + if (treq->af_specific->req_md5_lookup(sk, req_to_sk(req))) > newtp->tcp_header_len += TCPOLEN_MD5SIG_ALIGNED; > #endif > if (skb->len >= TCP_MSS_DEFAULT + newtp->tcp_header_len) > -- > 2.28.0 > >