From: Daniel Borkmann <daniel@iogearbox.net>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, bpf@vger.kernel.org,
kernel-team@fb.com, linux-security-module@vger.kernel.org,
acme@redhat.com, jamorris@linux.microsoft.com, jannh@google.com,
kpsingh@google.com
Subject: Re: [PATCH v5 bpf-next 2/3] bpf: implement CAP_BPF
Date: Tue, 12 May 2020 22:09:49 +0200 [thread overview]
Message-ID: <294922f0-2dab-8392-492a-ce0e04c03cee@iogearbox.net> (raw)
In-Reply-To: <20200512182944.wzfs7nzgppqn23l6@ast-mbp>
On 5/12/20 8:29 PM, Alexei Starovoitov wrote:
> On Tue, May 12, 2020 at 05:05:12PM +0200, Daniel Borkmann wrote:
>>> - env->allow_ptr_leaks = is_priv;
>>> + env->allow_ptr_leaks = perfmon_capable();
>>> + env->bpf_capable = bpf_capable();
>>
>> Probably more of a detail, but it feels weird to tie perfmon_capable() into the BPF
>> core and use it in various places there. I would rather make this a proper bpf_*
>> prefixed helper and add a more descriptive name (what does it have to do with perf
>> or monitoring directly?). For example, all the main functionality could be under
>> `bpf_base_capable()` and everything with potential to leak pointers or mem to user
>> space as `bpf_leak_capable()`. Then inside include/linux/capability.h this can still
>> resolve under the hood to something like:
>>
>> static inline bool bpf_base_capable(void)
>> {
>> return capable(CAP_BPF) || capable(CAP_SYS_ADMIN);
>> }
>
> I don't like the 'base' in the name, since 'base' implies common subset,
> but it's not the case. Also 'base' implies that something else is additive,
> but it's not the case either. The real base is unpriv. cap_bpf adds to it.
> So bpf_capable() in capability.h is the most appropriate.
> It also matches perfmon_capable() and other *_capable()
That's okay with me, naming is usually hardest. :)
>> static inline bool bpf_leak_capable(void)
>> {
>> return perfmon_capable();
>> }
>
> This is ok, but not in capability.h. I can put it into bpf_verifier.h
Makes sense.
next prev parent reply other threads:[~2020-05-12 20:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-08 21:53 [PATCH v5 bpf-next 0/3] Introduce CAP_BPF Alexei Starovoitov
2020-05-08 21:53 ` [PATCH v5 bpf-next 1/3] bpf, capability: " Alexei Starovoitov
2020-05-08 21:53 ` [PATCH v5 bpf-next 2/3] bpf: implement CAP_BPF Alexei Starovoitov
2020-05-12 0:12 ` sdf
2020-05-12 2:36 ` Alexei Starovoitov
2020-05-12 12:50 ` Jordan Glover
2020-05-12 15:46 ` Alexei Starovoitov
2020-05-12 15:54 ` sdf
2020-05-12 18:39 ` Alexei Starovoitov
2020-05-12 14:35 ` Daniel Borkmann
2020-05-12 18:25 ` Alexei Starovoitov
2020-05-12 20:07 ` Daniel Borkmann
2020-05-12 22:56 ` Alexei Starovoitov
2020-05-12 15:05 ` Daniel Borkmann
2020-05-12 18:29 ` Alexei Starovoitov
2020-05-12 20:09 ` Daniel Borkmann [this message]
2020-05-12 20:27 ` Daniel Borkmann
2020-05-12 23:01 ` Alexei Starovoitov
2020-05-08 21:53 ` [PATCH v5 bpf-next 3/3] selftests/bpf: use CAP_BPF and CAP_PERFMON in tests Alexei Starovoitov
2020-05-08 22:45 ` [PATCH v5 bpf-next 0/3] Introduce CAP_BPF Casey Schaufler
2020-05-08 23:00 ` Alexei Starovoitov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=294922f0-2dab-8392-492a-ce0e04c03cee@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=acme@redhat.com \
--cc=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=jamorris@linux.microsoft.com \
--cc=jannh@google.com \
--cc=kernel-team@fb.com \
--cc=kpsingh@google.com \
--cc=linux-security-module@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).