Received: by 10.213.65.68 with SMTP id h4csp520636imn; Thu, 22 Mar 2018 02:36:05 -0700 (PDT) X-Google-Smtp-Source: AG47ELuOKWnHqjAl1kBzJCNVyfvQaWZHblo+iBpwHHJJNGdYpEd5BzmzzGt7MKHqEl65WFisZP07 X-Received: by 2002:a17:902:5489:: with SMTP id e9-v6mr16382546pli.306.1521711365125; Thu, 22 Mar 2018 02:36:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521711365; cv=none; d=google.com; s=arc-20160816; b=GE+ooQtMyxHWis9OujNWYZnDiEAn2Z/dLOI/mnNMuNAz6b8vMxTCxjNtYjMpSuqBFC cIiifs9AEzS15eU2oZCfv4aznuV9VBx1lDae+TfK6JO5G9xeW/ouPMD3h7gyNTfXy1BF HkTag0T4xMTXfsncwOBCrEEZyWmFFcQKrM9i4LgzNWjv+W6LL7/+5gmwTrjCB37UQiFc iMJ0rwmCFzAwVDW8vY0rRTKWmH3KklmoUeXXq4GRcrq3EURSabJeJ1Ql/nGc7M0uDS3O 9TJ1BfQ63PdoNopCUYexgUvjsc4nYf416Rw9vi8KIWJOhg1sJnIWqgYQnNs1Lw5xl8CR fC0g== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=99DqciWMnOVCMgeCxBAYeFrvUIe2J4mrkIlYsyMKhbU=; b=pDQjkn7xbRqGsKiTK0FWSgZ1VBQnrs0qnG4H0CZKzTnx/TIU/Zdc92EY/e0XGv5M+w WT6cjsicULkLTbxG2V9vyH44qll+pRT5Lyqp72oOBBW4nZwXr4S3riWrJw/ZIC2oVYwl YMi+utAhid1YelQhO6B9+izbBX1Ybqa/hWkhHao8KRAipZYAu+bfpuwYNXznnvIE0Uwj 5UaBzzsnQgwtrwu2PUAYz8rQ+7iMqtcyIm01/IYhbqVDp7WuP+ZRXi7mNfFp8qj2YGXW GRR1vmtnb2EWe9If5P01BH3Yvetk911yJz3kpYvKTAgrBWlYD1c3Gy6s+KHc/OwJNLgW ZEJA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g191si4075944pgc.352.2018.03.22.02.35.50; Thu, 22 Mar 2018 02:36:05 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753264AbeCVJe1 (ORCPT + 99 others); Thu, 22 Mar 2018 05:34:27 -0400 Received: from www62.your-server.de ([213.133.104.62]:36851 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752954AbeCVJeY (ORCPT ); Thu, 22 Mar 2018 05:34:24 -0400 Received: from [85.7.107.67] (helo=linux.home) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-SHA:256) (Exim 4.85_2) (envelope-from ) id 1eywbz-0000aV-1s; Thu, 22 Mar 2018 10:34:19 +0100 Subject: Re: [PATCH 1/2] bpf: Remove struct bpf_verifier_env argument from print_bpf_insn To: Jiri Olsa , Quentin Monnet Cc: Jiri Olsa , Alexei Starovoitov , lkml , netdev@vger.kernel.org References: <20180321150212.5586-1-jolsa@kernel.org> <20180321183749.GF2707@krava> From: Daniel Borkmann Message-ID: Date: Thu, 22 Mar 2018 10:34:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20180321183749.GF2707@krava> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.99.3/24409/Thu Mar 22 05:17:26 2018) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/21/2018 07:37 PM, Jiri Olsa wrote: > On Wed, Mar 21, 2018 at 05:25:33PM +0000, Quentin Monnet wrote: >> 2018-03-21 16:02 UTC+0100 ~ Jiri Olsa >>> We use print_bpf_insn in user space (bpftool and soon perf), >>> so it'd be nice to keep it generic and strip it off the kernel >>> struct bpf_verifier_env argument. >>> >>> This argument can be safely removed, because its users can >>> use the struct bpf_insn_cbs::private_data to pass it. >>> >>> Signed-off-by: Jiri Olsa >>> --- >>> kernel/bpf/disasm.c | 52 +++++++++++++++++++++++++-------------------------- >>> kernel/bpf/disasm.h | 5 +---- >>> kernel/bpf/verifier.c | 6 +++--- >>> 3 files changed, 30 insertions(+), 33 deletions(-) >> >> [...] >> >>> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c >>> index c6eff108aa99..9f27d3fa7259 100644 >>> --- a/kernel/bpf/verifier.c >>> +++ b/kernel/bpf/verifier.c >>> @@ -202,8 +202,7 @@ EXPORT_SYMBOL_GPL(bpf_verifier_log_write); >>> * generic for symbol export. The function was renamed, but not the calls in >>> * the verifier to avoid complicating backports. Hence the alias below. >>> */ >>> -static __printf(2, 3) void verbose(struct bpf_verifier_env *env, >>> - const char *fmt, ...) >>> +static __printf(2, 3) void verbose(void *private_data, const char *fmt, ...) >>> __attribute__((alias("bpf_verifier_log_write"))); >> >> Just as a note, verbose() will be aliased to a function whose prototype >> differs (bpf_verifier_log_write() still expects a struct >> bpf_verifier_env as its first argument). I am not so familiar with >> function aliases, could this change be a concern? > > yea, but as it was pointer for pointer switch I did not > see any problem with that.. I'll check more Ok, holding off for now until we have clarification. Other option could also be to make it void *private_data everywhere and for the kernel writer then do struct bpf_verifier_env *env = private_data.