From: John Fastabend <john.fastabend@gmail.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>, bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>, Yonghong Song <yhs@fb.com>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>
Subject: RE: [PATCH bpf v1 1/3] bpf: Move bpf_loop and bpf_for_each_map_elem under CAP_BPF
Date: Tue, 23 Aug 2022 01:29:54 -0700 [thread overview]
Message-ID: <630490024ded0_2ad4d7208e3@john.notmuch> (raw)
In-Reply-To: <20220822131923.21476-2-memxor@gmail.com>
Kumar Kartikeya Dwivedi wrote:
> 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>
> ---
This should have a fixes tag IMO. You'll get unexpected results if we
don't have get it backported to the right places.
> kernel/bpf/helpers.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
> index 1f961f9982d2..d0e80926bac5 100644
> --- a/kernel/bpf/helpers.c
> +++ b/kernel/bpf/helpers.c
> @@ -1633,10 +1633,6 @@ bpf_base_func_proto(enum bpf_func_id func_id)
> return &bpf_ringbuf_submit_dynptr_proto;
> case BPF_FUNC_ringbuf_discard_dynptr:
> return &bpf_ringbuf_discard_dynptr_proto;
> - case BPF_FUNC_for_each_map_elem:
> - return &bpf_for_each_map_elem_proto;
> - case BPF_FUNC_loop:
> - return &bpf_loop_proto;
> case BPF_FUNC_strncmp:
> return &bpf_strncmp_proto;
> case BPF_FUNC_dynptr_from_mem:
> @@ -1675,6 +1671,10 @@ bpf_base_func_proto(enum bpf_func_id func_id)
> return &bpf_timer_cancel_proto;
> case BPF_FUNC_kptr_xchg:
> return &bpf_kptr_xchg_proto;
> + case BPF_FUNC_for_each_map_elem:
> + return &bpf_for_each_map_elem_proto;
> + case BPF_FUNC_loop:
> + return &bpf_loop_proto;
> default:
> break;
> }
> --
> 2.34.1
>
next prev parent reply other threads:[~2022-08-23 9:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-22 13:19 [PATCH bpf v1 0/3] Fix reference state management for synchronous callbacks Kumar Kartikeya Dwivedi
2022-08-22 13:19 ` [PATCH bpf v1 1/3] bpf: Move bpf_loop and bpf_for_each_map_elem under CAP_BPF Kumar Kartikeya Dwivedi
2022-08-23 8:29 ` John Fastabend [this message]
2022-08-23 17:35 ` Kumar Kartikeya Dwivedi
2022-08-23 23:27 ` Alexei Starovoitov
2022-08-22 13:19 ` [PATCH bpf v1 2/3] bpf: Fix reference state management for synchronous callbacks Kumar Kartikeya Dwivedi
2022-08-22 13:19 ` [PATCH bpf v1 3/3] selftests/bpf: Add tests for reference state fixes for callbacks Kumar Kartikeya Dwivedi
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=630490024ded0_2ad4d7208e3@john.notmuch \
--to=john.fastabend@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=memxor@gmail.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