From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, "Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Network Development" <netdev@vger.kernel.org>,
netfilter-devel <netfilter-devel@vger.kernel.org>,
"Martin KaFai Lau" <kafai@fb.com>,
"Song Liu" <songliubraving@fb.com>, "Yonghong Song" <yhs@fb.com>,
"John Fastabend" <john.fastabend@gmail.com>,
"Maxim Mikityanskiy" <maximmi@nvidia.com>,
"Pablo Neira Ayuso" <pablo@netfilter.org>,
"Florian Westphal" <fw@strlen.de>,
"Jesper Dangaard Brouer" <brouer@redhat.com>,
"Toke Høiland-Jørgensen" <toke@redhat.com>
Subject: Re: [PATCH bpf-next v6 03/11] bpf: Populate kfunc BTF ID sets in struct btf
Date: Fri, 7 Jan 2022 11:56:45 +0530 [thread overview]
Message-ID: <20220107062645.d5hdazzkvl4d2fhq@apollo.legion> (raw)
In-Reply-To: <CAADnVQ+J+733_LU0QchkmpZz511_sCTeOAYi5MQ4YFMZQMygTA@mail.gmail.com>
On Fri, Jan 07, 2022 at 05:10:56AM IST, Alexei Starovoitov wrote:
> On Thu, Jan 6, 2022 at 12:59 AM Kumar Kartikeya Dwivedi
> <memxor@gmail.com> wrote:
> >
> > I'm not insisting, but for vmlinux we will have multiple
> > register_btf_kfunc_id_set calls for same hook, so we have to concat multiple
> > sets into one, which may result in an unsorted set. It's ok to not sort for
> > modules where only one register call per hook is allowed.
> >
> > Unless we switch to linear search for now (which is ok by me), we have to
> > re-sort for vmlinux BTF, to make btf_id_set_contains (in
> > btf_kfunc_id_set_contains) work.
>
> Could you give an example when it happens in vmlinux?
> Is it when modules are built-in (like tcp_bbr.c, tcp_cubic.c) ?
> But then they should go into struct btf of the module?
> Or THIS_MODULE becomes vmlinux and everything goes there?
> If that's the case then yeah, sorting is needed.
Yep, THIS_MODULE would be NULL, and it would pick vmlinux BTF for storing the
set.
Your suggestion to do direct assignment for module case is also good, since we
always ensure module refcount is held when looking into set, access to it should
be safe.
> Please make it clear in the comment and the commit log.
> It should be clear to reviewers without having to grill the author
> with questions.
> Would certainly save time for both author and reviewer. Agree?
Agreed, I'll add the comments and respin.
Thanks for your review.
--
Kartikeya
next prev parent reply other threads:[~2022-01-07 6:27 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-02 16:21 [PATCH bpf-next v6 00/11] Introduce unstable CT lookup helpers Kumar Kartikeya Dwivedi
2022-01-02 16:21 ` [PATCH bpf-next v6 01/11] kernel: Implement try_module_get_live Kumar Kartikeya Dwivedi
2022-01-25 18:50 ` Luis Chamberlain
2022-01-02 16:21 ` [PATCH bpf-next v6 02/11] bpf: Fix UAF due to race between btf_try_get_module and load_module Kumar Kartikeya Dwivedi
2022-01-05 6:10 ` Alexei Starovoitov
2022-01-06 8:46 ` Kumar Kartikeya Dwivedi
2022-01-02 16:21 ` [PATCH bpf-next v6 03/11] bpf: Populate kfunc BTF ID sets in struct btf Kumar Kartikeya Dwivedi
2022-01-05 6:19 ` Alexei Starovoitov
2022-01-06 8:59 ` Kumar Kartikeya Dwivedi
2022-01-06 23:40 ` Alexei Starovoitov
2022-01-07 6:26 ` Kumar Kartikeya Dwivedi [this message]
2022-01-02 16:21 ` [PATCH bpf-next v6 04/11] bpf: Remove check_kfunc_call callback and old kfunc BTF ID API Kumar Kartikeya Dwivedi
2022-01-02 16:21 ` [PATCH bpf-next v6 05/11] bpf: Introduce mem, size argument pair support for kfunc Kumar Kartikeya Dwivedi
2022-01-02 16:21 ` [PATCH bpf-next v6 06/11] bpf: Add reference tracking support to kfunc Kumar Kartikeya Dwivedi
2022-01-02 16:21 ` [PATCH bpf-next v6 07/11] net/netfilter: Add unstable CT lookup helpers for XDP and TC-BPF Kumar Kartikeya Dwivedi
2022-01-02 16:21 ` [PATCH bpf-next v6 08/11] selftests/bpf: Add test for unstable CT lookup API Kumar Kartikeya Dwivedi
2022-01-02 16:21 ` [PATCH bpf-next v6 09/11] selftests/bpf: Add test_verifier support to fixup kfunc call insns Kumar Kartikeya Dwivedi
2022-01-02 16:21 ` [PATCH bpf-next v6 10/11] selftests/bpf: Extend kfunc selftests Kumar Kartikeya Dwivedi
2022-01-02 16:21 ` [PATCH bpf-next v6 11/11] selftests/bpf: Add test for race in btf_try_get_module Kumar Kartikeya Dwivedi
2022-01-05 6:20 ` Alexei Starovoitov
2022-01-06 9:04 ` Kumar Kartikeya Dwivedi
2022-01-06 19:39 ` Andrii Nakryiko
2022-01-07 7:22 ` Kumar Kartikeya Dwivedi
2022-01-07 20:10 ` 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=20220107062645.d5hdazzkvl4d2fhq@apollo.legion \
--to=memxor@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=daniel@iogearbox.net \
--cc=fw@strlen.de \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=maximmi@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=songliubraving@fb.com \
--cc=toke@redhat.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