]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Move bpf_loop and bpf_for_each_map_elem under CAP_BPF
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Tue, 23 Aug 2022 01:31:17 +0000 (03:31 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 23 Aug 2022 23:21:59 +0000 (16:21 -0700)
commit2469008f7deaa7b40c90c6a26124942a0226f294
tree8a9fed6c23507723412c96b55fe5455b1d432f62
parentdffabfa7a989aa4c5f1aefa8c0dfd9008a1e553a
bpf: Move bpf_loop and bpf_for_each_map_elem under CAP_BPF

They would require func_info which needs prog BTF anyway. Loading BTF
and setting the prog btf_fd while loading the prog indirectly requires
CAP_BPF, so just to reduce confusion, move both these helpers taking
callback under bpf_capable() protection as well, since they cannot be
used without CAP_BPF.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20220823013117.24916-1-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/helpers.c