Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2493681ybe; Thu, 12 Sep 2019 10:12:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqziQ6a1BioN2UsKX6vrduRLdwMjVTiBILxEhfEw8oPyp6mMW1DFYC8iMQZBDrq5Y3xmEtHq X-Received: by 2002:a50:f19c:: with SMTP id x28mr42460744edl.42.1568308345338; Thu, 12 Sep 2019 10:12:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568308345; cv=none; d=google.com; s=arc-20160816; b=ESKLiPolVMeDvl2GpYfc4G1ohbpmw4tDKewV+7/d+xg9zIEzlQskiyBIUYwRjiIyxS xyCZ5DI7MONXsAhEOuFmKNY5SegqCBChPrbiHja6MSuT4+oTupWak/XcEyAWC3X1VJj3 q0DICLLIEsR31NZQ+JAASMAtJYFbjY52/dZ5ustjTNUg0U3TsNnDk5NoKzODUSRCffcK Iq6zT1ZCOqJF9GD7pJUvUE3geu8vhv0OM+3EWhsXBpJDyTGqYmruBqLmCGb5HzcKqppS O8ydixS1FAKVOaee1eLfx1WzcLSsymWGAFOz0zgxBjqpxTDdQCfVetUAH3Ba8u2LEQJc 0o4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from; bh=otHdSbvatXIzjioepuSmR5TDFJCHbTHCXX4ZC6GztCI=; b=z9pF1TFEVpswv5JFZzfi5OgFWMHtCqIQu1NSgZ6MlR8V5CgcA2qNzlqt+40QgqtqfJ e7N5l90C3Qt9hafEcQLpRdNr0FkYjx+cy2jdhfGOWaazMVkxWa4GMxVJSJ3lEqQrnoFT /4ISgvf82ih7Tpad8SYl+ZYJTYDcRFfgEdcX7PhG+N1g2W+IhWmWh4+ksPTXx3BARebI TLW/GOmec7myMaaP8AMUKD175x1rp5Oynh6PhyD+WDQOHti1/RyBvO0lgu9ZZZIMTKD/ 6BQenlpiOi0whfVSyGMigZp5KNn/miP03WW/LXTP59ma+hxm/XWTqLvcmQYPvSl6uM4d 8ZvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e25si14664037edb.308.2019.09.12.10.12.00; Thu, 12 Sep 2019 10:12:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730470AbfILKwE convert rfc822-to-8bit (ORCPT + 99 others); Thu, 12 Sep 2019 06:52:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58058 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730680AbfILKwE (ORCPT ); Thu, 12 Sep 2019 06:52:04 -0400 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D9524B62C for ; Thu, 12 Sep 2019 10:52:03 +0000 (UTC) Received: by mail-ed1-f72.google.com with SMTP id c23so14524619edb.14 for ; Thu, 12 Sep 2019 03:52:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=6flBUBjs8VPAbAefuygCBR5yf5XU4QbU0qOIz+By8ZI=; b=AqMFnf66Jm5ktTqEVxQuyowRg1+niMFkPbgNJlaRhWLEAVHizkU7kre/pJTP5FPs71 /X2PpKnDdxKis5TchjQ3Fp+uc3qi3C8o+mTH7SrahmmmrvJ37LzQJ5CAR6af8O+tzoIQ 4OtVSnOTnSLkWqg3tbAnn6th6wMTlNaZwgS4ZHBuhlUi377aOTlSUXqb78dYHdkFhzPZ TO66CAVs7lwqqPlPdCld02hXOZG6GGkmAfKUvdhjmo2DlBxLda0SFLrML4QNldD8OhNJ WhPZ2yjXpLnK6Qz4+DIJNjLePN4xOZCqTjGX+LBDTk/MXg17x/v7XMfeSjT4yQ8gqt6n d27w== X-Gm-Message-State: APjAAAXeN2QxclqC2aRfCkx//M/aeUio3PeZuuMgxldZyLRLfitHS7SP 7pp8s1fLVDPsz4hsT8TH1B9ZrQhE2WTJVHWySqWvemPGGNisl9DYGqBtSkIgMvymPl3I3KEpPFJ 9fnm47c8Zi2nasvXrsH8ArBsQ X-Received: by 2002:a17:907:2065:: with SMTP id qp5mr33221229ejb.151.1568285522642; Thu, 12 Sep 2019 03:52:02 -0700 (PDT) X-Received: by 2002:a17:907:2065:: with SMTP id qp5mr33221211ejb.151.1568285522444; Thu, 12 Sep 2019 03:52:02 -0700 (PDT) Received: from alrua-x1.borgediget.toke.dk (borgediget.toke.dk. [85.204.121.218]) by smtp.gmail.com with ESMTPSA id u27sm4714326edb.48.2019.09.12.03.52.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Sep 2019 03:52:01 -0700 (PDT) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 8960C180613; Thu, 12 Sep 2019 11:46:39 +0100 (WEST) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Sami Tolvanen Cc: =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , Yonghong Song , Alexei Starovoitov , Daniel Borkmann , Kees Cook , Martin Lau , Song Liu , "netdev\@vger.kernel.org" , "bpf\@vger.kernel.org" , "linux-kernel\@vger.kernel.org" , Jesper Dangaard Brouer Subject: Re: [PATCH] bpf: validate bpf_func when BPF_JIT is enabled In-Reply-To: References: <20190909223236.157099-1-samitolvanen@google.com> <4f4136f5-db54-f541-2843-ccb35be25ab4@fb.com> <20190910172253.GA164966@google.com> <87impzt4pu.fsf@toke.dk> X-Clacks-Overhead: GNU Terry Pratchett Date: Thu, 12 Sep 2019 11:46:39 +0100 Message-ID: <87sgp1ssfk.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sami Tolvanen writes: > On Wed, Sep 11, 2019 at 5:09 AM Toke Høiland-Jørgensen wrote: >> >> Björn Töpel writes: >> > I ran the "xdp_rxq_info" sample with and without Sami's patch: >> >> Thanks for doing this! > > Yes, thanks for testing this Björn! > >> Or (1/22998700 - 1/23923874) * 10**9 == 1.7 nanoseconds of overhead. >> >> I guess that is not *too* bad; but it's still chipping away at >> performance; anything we could do to lower the overhead? > > The check is already rather minimal, but I could move this to a static > inline function to help ensure the compiler doesn't generate an > additional function call for this. I'm also fine with gating this > behind a separate config option, but I'm not sure if that's worth it. > Any thoughts? I think it would be good if you do both. I'm a bit worried that XDP performance will end up in a "death by a thousand paper cuts" situation, so I'd rather push back on even relatively small overheads like this; so being able to turn it off in the config would be good. Can you share more details about what the "future CFI checking" is likely to look like? -Toke