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=-3.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 81C28C433E1 for ; Fri, 21 Aug 2020 10:22:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5BEC7207BB for ; Fri, 21 Aug 2020 10:22:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cloudflare.com header.i=@cloudflare.com header.b="egpmqULc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728652AbgHUKWy (ORCPT ); Fri, 21 Aug 2020 06:22:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728489AbgHUKWx (ORCPT ); Fri, 21 Aug 2020 06:22:53 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E0EAC061386 for ; Fri, 21 Aug 2020 03:22:52 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id c8so655602lfh.9 for ; Fri, 21 Aug 2020 03:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=5nytGNra5OD91xv+bDTLtlhTDCMjbsKBNY0iw1VfP4w=; b=egpmqULcE+bTLBbkGJklCmbTsdzrrFlWYR/6vpd6TVLnhQOPh4FdsIS3pKYyR3jCfM 1fXjdlEA+Wq00jq07thEKpf6qEpBgpC4UozZZOev8XYlCVz1+TV0H3zKI4gQLjPm6l9k hl9bkCJyMpWVQF7Gdjvoj/rMXs3kS9mueCsmA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=5nytGNra5OD91xv+bDTLtlhTDCMjbsKBNY0iw1VfP4w=; b=ceWUjEr2L7lLAaMChOg7cTa05RuJ+NV4sXwPzgDwrf/friDZ9jmEWtjfwd1Fg7ERA8 KVd1jc27l1Dzn/flulgAbv0QsMwrlUInJbWGPZvRDCZMmqOM14D8rT5Z9CxRJTmL2BSE zkFk/urO09v3lLt5pfD/osQkbTD1MGJtJ69m7VkDqKJJ/WlRPaQNR4xBmEtirI8/BcCV sQd65lU3SYl4vAuPrZhQXLSQ0+ELqpIy1SO0XYeKjzLzJVxjrFn7Y3klUe0lifGEejr5 kbEBmEBalNwPBI9lKjzZAFKRRxOZW124llz7wF8w6lzohznAHSjMs0srgBi4Sj0+cRPf ox/g== X-Gm-Message-State: AOAM531ru4KODVDkjknsN6ENklc8SuYNPZFEmCnxaJq38Mdeg+7XnIFs Nmoffg7ImGJy8+I2njPJdD79mg== X-Google-Smtp-Source: ABdhPJxVMjRPYlwXss0xDfjV3MPFKodafcbZ8jOsV3UL2xCeztiEixF5Z3CdKWRlW2kNOLFsTaC6uQ== X-Received: by 2002:a05:6512:31c2:: with SMTP id j2mr1156217lfe.85.1598005368172; Fri, 21 Aug 2020 03:22:48 -0700 (PDT) Received: from cloudflare.com ([176.221.114.230]) by smtp.gmail.com with ESMTPSA id q29sm294512lfb.94.2020.08.21.03.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 03:22:47 -0700 (PDT) References: <20200717103536.397595-1-jakub@cloudflare.com> <87lficrm2v.fsf@cloudflare.com> <87k0xtsj91.fsf@cloudflare.com> User-agent: mu4e 1.1.0; emacs 26.3 From: Jakub Sitnicki To: Alexei Starovoitov Cc: bpf , Network Development , kernel-team , Alexei Starovoitov , Daniel Borkmann , "David S. Miller" , Jakub Kicinski , Andrii Nakryiko , Lorenz Bauer , Marek Majkowski , Martin KaFai Lau , Yonghong Song Subject: Re: BPF sk_lookup v5 - TCP SYN and UDP 0-len flood benchmarks In-reply-to: Date: Fri, 21 Aug 2020 12:22:46 +0200 Message-ID: <87imdcs3gp.fsf@cloudflare.com> MIME-Version: 1.0 Content-Type: text/plain Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Fri, Aug 21, 2020 at 12:18 AM CEST, Alexei Starovoitov wrote: > On Thu, Aug 20, 2020 at 3:29 AM Jakub Sitnicki wrote: >> On Tue, Aug 18, 2020 at 08:19 PM CEST, Alexei Starovoitov wrote: [...] >> > Long term we should probably stop doing *_kern style of ctx passing >> > into bpf progs. >> > We have BTF, CO-RE and freplace now. This old style of memset *_kern and manual >> > ctx conversion has performance implications and annoying copy-paste of ctx >> > conversion routines. >> > For this particular case instead of introducing udp4_lookup_run_bpf() >> > and copying registers into stack we could have used freplace of >> > udp4_lib_lookup2. >> > More verifier work needed, of course. >> > My main point that existing approach "lets prep args for bpf prog to >> > run" that is used >> > pretty much in every bpf hook is no longer necessary. >> >> Andrii has also suggested leveraging BTF [0], but to expose the *_kern >> struct directly to BPF prog instead of emitting ctx access instructions. >> >> What I'm curious about is if we get rid of prepping args and ctx >> conversion, then how do we limit what memory BPF prog can access? >> >> Say, I'm passing a struct sock * to my BPF prog. If it's not a tracing >> prog, then I don't want it to have access to everything that is >> reachable from struct sock *. This is where this approach currently >> breaks down for me. > > Why do you want to limit it? > Time after time we keep extending structs in uapi/bpf.h because new > use cases are coming up. Just let the prog access everything. I guess I wasn't thinking big enough :-)