[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0f883adc-1e8c-4b76-4b4e-98d95081993a@iogearbox.net>
Date: Wed, 29 Apr 2020 16:35:37 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Quentin Monnet <quentin@...valent.com>,
Alexei Starovoitov <ast@...nel.org>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org,
Richard Palethorpe <rpalethorpe@...e.com>,
Michael Kerrisk <mtk.manpages@...il.com>
Subject: Re: [PATCH bpf-next v2 2/3] tools: bpftool: allow unprivileged users
to probe features
On 4/29/20 3:05 PM, Quentin Monnet wrote:
> There is demand for a way to identify what BPF helper functions are
> available to unprivileged users. To do so, allow unprivileged users to
> run "bpftool feature probe" to list BPF-related features. This will only
> show features accessible to those users, and may not reflect the full
> list of features available (to administrators) on the system.
>
> To avoid the case where bpftool is inadvertently run as non-root and
> would list only a subset of the features supported by the system when it
> would be expected to list all of them, running as unprivileged is gated
> behind the "unprivileged" keyword passed to the command line. When used
> by a privileged user, this keyword allows to drop the CAP_SYS_ADMIN and
> to list the features available to unprivileged users. Note that this
> addsd a dependency on libpcap for compiling bpftool.
>
> Note that there is no particular reason why the probes were restricted
> to root, other than the fact I did not need them for unprivileged and
> did not bother with the additional checks at the time probes were added.
>
> Signed-off-by: Quentin Monnet <quentin@...valent.com>
> ---
> .../bpftool/Documentation/bpftool-feature.rst | 10 +-
> tools/bpf/bpftool/Makefile | 2 +-
> tools/bpf/bpftool/bash-completion/bpftool | 2 +-
> tools/bpf/bpftool/feature.c | 100 +++++++++++++++---
> 4 files changed, 99 insertions(+), 15 deletions(-)
>
> diff --git a/tools/bpf/bpftool/Documentation/bpftool-feature.rst b/tools/bpf/bpftool/Documentation/bpftool-feature.rst
> index b04156cfd7a3..ca085944e4cf 100644
> --- a/tools/bpf/bpftool/Documentation/bpftool-feature.rst
> +++ b/tools/bpf/bpftool/Documentation/bpftool-feature.rst
> @@ -19,7 +19,7 @@ SYNOPSIS
> FEATURE COMMANDS
> ================
>
> -| **bpftool** **feature probe** [*COMPONENT*] [**full**] [**macros** [**prefix** *PREFIX*]]
> +| **bpftool** **feature probe** [*COMPONENT*] [**full**] [**unprivileged**] [**macros** [**prefix** *PREFIX*]]
> | **bpftool** **feature help**
Looks good to me, thanks! There is one small thing missing which is updating
do_help() to display the same as above from bpftool help, but rest lgtm.
Powered by blists - more mailing lists