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=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS 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 6A422C04AA7 for ; Mon, 13 May 2019 23:45:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3638620850 for ; Mon, 13 May 2019 23:45:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="edP2unho" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726551AbfEMXpi (ORCPT ); Mon, 13 May 2019 19:45:38 -0400 Received: from mail-yw1-f67.google.com ([209.85.161.67]:41854 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726233AbfEMXph (ORCPT ); Mon, 13 May 2019 19:45:37 -0400 Received: by mail-yw1-f67.google.com with SMTP id o65so12470383ywd.8 for ; Mon, 13 May 2019 16:45:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=I61dv/srKkbPr0MSpNNyf5HMVuXv4XnCDZMGZoEsBtg=; b=edP2unho3JGfLVtRf4xIIeNbT/1DKDyqQVTwvP5XUpMVKx5NqhxzehVcbDKHzP6RC2 dV1+g8QZah6EIbPImPJIGmLn0c+8Gq7azQ+fl0CcULfpfJsnhdODBzNXSgHawHmMR2x3 RP3kG+SJf47u611zaWk0uB4C0OLU3JJ5tCLEzP48lELR9A6YNbipT2rIXjROr/YAiABB wXJsu1kd8qhiHxSJxcEW7auCj6xPGrxFE4+90qvoBRwxlHZ0uaLJhuX6GFExFV7Gth0G CcgUw48M2f3YB/cWWjKB7lmNGtYpn+C4xSt47jmsj/qFklkQ6P3pAmslQaT1CKvrVnh2 gdWg== 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=I61dv/srKkbPr0MSpNNyf5HMVuXv4XnCDZMGZoEsBtg=; b=mY22JTfaP0gIy5YNSqywEYb1C7oVtXk+VuYalVQmNEIhMon5dUk5KsvAl5GiHetwas 64K6EKdpM3830q03dkPg0kYU6py0BbBoYdBA84ku/6H7bgF1NDFbunf2g+EdWlByWw4/ hCNrnWy1z0ARPFG3Ef0/76SBQIS6K3lXp8NJyNuWdG8VTmnaVrZyhJxfisGe1uMAuZHS udCSg9tZicKByffu6IRfrLTFP7Yyt3ClS0Ypj2QSh000UrOVq1DR6RNjs/Dzvj+QR3Xd sJFvC700FWkiilaAxj6tOu1a7VZ9sk9Qr+dPFImLwNTaK44mVKrhA99PbaZ5viEs/Vid y1SA== X-Gm-Message-State: APjAAAV+CKsnh2TpzXpppavNLBbmBt/j8IqJFrx8ILBF45NkYnkTQC+g tbVHzrmKFYaJ1Zc7fUTICrPLtr4Q X-Google-Smtp-Source: APXvYqxxnJT1ugPDT0lzKtpAFQXHJvQanNBo4/Q3UycxJ2gvtttVKJGmJYNpo4x6mD0rmvkrACZbOQ== X-Received: by 2002:a25:d196:: with SMTP id i144mr14928630ybg.241.1557791136278; Mon, 13 May 2019 16:45:36 -0700 (PDT) Received: from mail-yw1-f47.google.com (mail-yw1-f47.google.com. [209.85.161.47]) by smtp.gmail.com with ESMTPSA id 136sm1166583yww.63.2019.05.13.16.45.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 May 2019 16:45:35 -0700 (PDT) Received: by mail-yw1-f47.google.com with SMTP id 186so12481049ywo.4 for ; Mon, 13 May 2019 16:45:34 -0700 (PDT) X-Received: by 2002:a0d:e386:: with SMTP id m128mr16039351ywe.283.1557791134580; Mon, 13 May 2019 16:45:34 -0700 (PDT) MIME-Version: 1.0 References: <20190513185402.220122-1-sdf@google.com> <20190513210239.GC24057@mini-arch> <20190513230513.GA10244@mini-arch> In-Reply-To: From: Willem de Bruijn Date: Mon, 13 May 2019 19:44:58 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf 1/2] flow_dissector: support FLOW_DISSECTOR_KEY_ETH_ADDRS with BPF To: Stanislav Fomichev Cc: Stanislav Fomichev , Willem de Bruijn , Network Development , bpf , David Miller , Alexei Starovoitov , Daniel Borkmann , Petar Penkov Content-Type: text/plain; charset="UTF-8" Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org From: Stanislav Fomichev Date: Mon, May 13, 2019 at 7:21 PM To: Stanislav Fomichev Cc: Willem de Bruijn , Network Development, bpf, David Miller, Alexei Starovoitov, Daniel Borkmann, Willem de Bruijn , Petar Penkov > > On 05/13, Willem de Bruijn wrote: > > > On Mon, May 13, 2019 at 5:21 PM Willem de Bruijn > > > wrote: > > > > > > > > On Mon, May 13, 2019 at 5:02 PM Stanislav Fomichev wrote: > > > > > > > > > > On 05/13, Willem de Bruijn wrote: > > > > > > On Mon, May 13, 2019 at 3:53 PM Stanislav Fomichev wrote: > > > > > > > > > > > > > > If we have a flow dissector BPF program attached to the namespace, > > > > > > > FLOW_DISSECTOR_KEY_ETH_ADDRS won't trigger because we exit early. > > > > > > > > > > > > I suppose that this is true for a variety of keys? For instance, also > > > > > > FLOW_DISSECTOR_KEY_IPV4_ADDRS. > > > > > > > > > I though the intent was to support most of the basic stuff (eth/ip/tcp/udp) > > > > > without any esoteric protocols. > > > > > > > > Indeed. But this applies both to protocols and the feature set. Both > > > > are more limited. > > > > > > > > > Not sure about FLOW_DISSECTOR_KEY_IPV4_ADDRS, > > > > > looks like we support that (except FLOW_DISSECTOR_KEY_TIPC part). > > > > > > > > Ah, I chose a bad example then. > > > > > > > > > > We originally intended BPF flow dissection for all paths except > > > > > > tc_flower. As that catches all the vulnerable cases on the ingress > > > > > > path on the one hand and it is infeasible to support all the > > > > > > flower features, now and future. I think that is the real fix. > > > > > > > > > Sorry, didn't get what you meant by the real fix. > > > > > Don't care about tc_flower? Just support a minimal set of features > > > > > needed by selftests? > > > > > > > > I do mean exclude BPF flow dissector (only) for tc_flower, as we > > > > cannot guarantee that the BPF program can fully implement the > > > > requested feature. > > > > > > Though, the user inserting the BPF flow dissector is the same as the > > > user inserting the flower program, the (per netns) admin. So arguably > > > is aware of the constraints incurred by BPF flow dissection. And else > > > can still detect when a feature is not supported from the (lack of) > > > output, as in this case of Ethernet address. I don't think we want to > > > mix BPF and non-BPF flow dissection though. That subverts the safety > > > argument of switching to BPF for flow dissection. > > Yes, we cannot completely avoid tc_flower because we use it to do > > the end-to-end testing. That's why I was trying to make sure "basic" > > stuff works (it might feel confusing that tc_flower {src,dst}_mac > > stop working with a bpf program installed). > > > > TBH, I'd not call this particular piece of code that exports src/dst > > addresses a dissection. At this point, it's a well-formed skb with > > a proper l2 header and we just copy the addresses out. It's probably > > part of the reason the original patch didn't include any skb->protocol > > checks. But it is not guaranteed to be an Ethernet link layer device. Making this a good example of why when moving to BPF for safety we should not keep any C dissection code in the path at all. > On the other hand, we can probably follow a simple rule: > if it's not exported via bpf_flow_keys (and src/dsc mac is not), > tc_flower is not supported as well. Agreed. I was using that as point of reference just now, too.