From: Alan Maguire <alan.maguire@oracle.com>
To: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org
Cc: kafai@fb.com, songliubraving@fb.com, yhs@fb.com,
john.fastabend@gmail.com, kpsingh@kernel.org,
keescook@chromium.org, bpf@vger.kernel.org
Subject: [PATCH v2 bpf-next 0/2] bpf: refine kernel.unpriviliged_bpf_disabled behaviour
Date: Tue, 17 May 2022 12:59:38 +0100 [thread overview]
Message-ID: <1652788780-25520-1-git-send-email-alan.maguire@oracle.com> (raw)
Unprivileged BPF disabled (kernel.unprivileged_bpf_disabled >= 1)
is the default in most cases now; when set, the BPF system call is
blocked for users without CAP_BPF/CAP_SYS_ADMIN. In some cases
however, it makes sense to split activities between capability-requiring
ones - such as program load/attach - and those that might not require
capabilities such as reading perf/ringbuf events, reading or
updating BPF map configuration etc. One example of this sort of
approach is a service that loads a BPF program, and a user-space
program that interacts with it.
Here - rather than blocking all BPF syscall commands - unprivileged
BPF disabled blocks the key object-creating commands (prog load,
map load). Discussion has alluded to this idea in the past [1],
and Alexei mentioned it was also discussed at LSF/MM/BPF this year.
Changes since RFC [2]:
- widened scope of commands unprivileged BPF disabled allows
(Alexei, patch 1)
- removed restrictions on map types for lookup, update, delete
(Alexei, patch 1)
- removed kernel CONFIG parameter controlling unprivilged bpf disabled
change (Alexei, patch 1)
- widened test scope to cover most BPF syscall commands, with positive
and negative subtests
[1] https://lore.kernel.org/bpf/CAADnVQLTBhCTAx1a_nev7CgMZxv1Bb7ecz1AFRin8tHmjPREJA@mail.gmail.com/
[2] https://lore.kernel.org/bpf/20220511163604.5kuczj6jx3ec5qv6@MBP-98dd607d3435.dhcp.thefacebook.com/T/#mae65f35a193279e718f37686da636094d69b96ee
Alan Maguire (2):
bpf: refine kernel.unpriviliged_bpf_disabled behaviour
selftests/bpf: add tests verifying unprivileged bpf behaviour
kernel/bpf/syscall.c | 14 +-
.../bpf/prog_tests/unpriv_bpf_disabled.c | 308 ++++++++++++++++++
.../bpf/progs/test_unpriv_bpf_disabled.c | 83 +++++
3 files changed, 404 insertions(+), 1 deletion(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/unpriv_bpf_disabled.c
create mode 100644 tools/testing/selftests/bpf/progs/test_unpriv_bpf_disabled.c
--
2.27.0
next reply other threads:[~2022-05-17 12:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-17 11:59 Alan Maguire [this message]
2022-05-17 11:59 ` [PATCH v2 bpf-next 1/2] bpf: refine kernel.unpriviliged_bpf_disabled behaviour Alan Maguire
2022-05-17 17:47 ` Yonghong Song
2022-05-17 11:59 ` [PATCH v2 bpf-next 2/2] selftests/bpf: add tests verifying unprivileged bpf disabled behaviour Alan Maguire
2022-05-17 16:45 ` Alexei Starovoitov
2022-05-17 20:43 ` Yonghong Song
2022-05-19 0:47 ` Andrii Nakryiko
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=1652788780-25520-1-git-send-email-alan.maguire@oracle.com \
--to=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=keescook@chromium.org \
--cc=kpsingh@kernel.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/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