]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Gate dynptr API behind CAP_BPF
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Wed, 21 Sep 2022 14:35:50 +0000 (16:35 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 21 Sep 2022 21:11:23 +0000 (14:11 -0700)
commitc522fd92f4787764821b8d31caf9f46f1b1ab815
tree5be18b6e0f5ad60dc22befc4b156d0d7f8ca1451
parent5c09d1e69fc9b371792c61c1aff83dc87051c921
bpf: Gate dynptr API behind CAP_BPF

This has been enabled for unprivileged programs for only one kernel
release, hence the expected annoyances due to this move are low. Users
using ringbuf can stick to non-dynptr APIs. The actual use cases dynptr
is meant to serve may not make sense in unprivileged BPF programs.

Hence, gate these helpers behind CAP_BPF and limit use to privileged
BPF programs.

Fixes: 491630e5c885 ("bpf: Add bpf_dynptr_from_mem for local dynptrs")
Fixes: 3cf8258360f5 ("bpf: Dynptr support for ring buffers")
Fixes: 3ce61a9de7cf ("bpf: Add bpf_dynptr_read and bpf_dynptr_write")
Fixes: 26527b33af98 ("bpf: Add dynptr data slices")
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20220921143550.30247-1-memxor@gmail.com
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/helpers.c