From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Andrii Nakryiko <andrii@kernel.org>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, ast@fb.com,
daniel@iogearbox.net, kernel-team@fb.com
Subject: Re: [PATCH v4 bpf-next 10/14] bpf: allow to specify kernel module BTFs when attaching BPF programs
Date: Wed, 2 Dec 2020 12:58:09 -0800 [thread overview]
Message-ID: <20201202205809.qwbismdmmtrcsar7@ast-mbp> (raw)
In-Reply-To: <20201202001616.3378929-11-andrii@kernel.org>
On Tue, Dec 01, 2020 at 04:16:12PM -0800, Andrii Nakryiko wrote:
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index c3458ec1f30a..60b95b51ccb8 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -558,6 +558,7 @@ union bpf_attr {
> __u32 line_info_cnt; /* number of bpf_line_info records */
> __u32 attach_btf_id; /* in-kernel BTF type id to attach to */
> __u32 attach_prog_fd; /* 0 to attach to vmlinux */
> + __u32 attach_btf_obj_id; /* vmlinux/module BTF object ID for BTF type */
I think the uapi should use attach_btf_obj_fd here.
Everywhere else uapi is using FDs to point to maps, progs, BTFs of progs.
BTF of a module isn't different from BTF of a program.
Looking at libbpf implementation... it has the FD of a module anyway,
since it needs to fetch it to search for the function btf_id in there.
So there won't be any inconvenience for libbpf to pass FD in here.
From the uapi perspective attach_btf_obj_fd will remove potential
race condition. It's very unlikely race, of course.
The rest of the series look good to me.
next prev parent reply other threads:[~2020-12-02 20:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-02 0:16 [PATCH v4 bpf-next 00/14] Support BTF-powered BPF tracing programs for kernel modules Andrii Nakryiko
2020-12-02 0:16 ` [PATCH v4 bpf-next 01/14] bpf: fix bpf_put_raw_tracepoint()'s use of __module_address() Andrii Nakryiko
2020-12-02 0:16 ` [PATCH v4 bpf-next 02/14] bpf: keep module's btf_data_size intact after load Andrii Nakryiko
2020-12-02 0:16 ` [PATCH v4 bpf-next 03/14] libbpf: add internal helper to load BTF data by FD Andrii Nakryiko
2020-12-02 0:16 ` [PATCH v4 bpf-next 04/14] libbpf: refactor CO-RE relocs to not assume a single BTF object Andrii Nakryiko
2020-12-02 0:16 ` [PATCH v4 bpf-next 05/14] libbpf: add kernel module BTF support for CO-RE relocations Andrii Nakryiko
2020-12-02 0:16 ` [PATCH v4 bpf-next 06/14] selftests/bpf: add bpf_testmod kernel module for testing Andrii Nakryiko
2020-12-02 0:16 ` [PATCH v4 bpf-next 07/14] selftests/bpf: add support for marking sub-tests as skipped Andrii Nakryiko
2020-12-02 0:16 ` [PATCH v4 bpf-next 08/14] selftests/bpf: add CO-RE relocs selftest relying on kernel module BTF Andrii Nakryiko
2020-12-02 0:16 ` [PATCH v4 bpf-next 09/14] bpf: remove hard-coded btf_vmlinux assumption from BPF verifier Andrii Nakryiko
2020-12-02 0:16 ` [PATCH v4 bpf-next 10/14] bpf: allow to specify kernel module BTFs when attaching BPF programs Andrii Nakryiko
2020-12-02 20:58 ` Alexei Starovoitov [this message]
2020-12-02 22:43 ` Andrii Nakryiko
2020-12-02 23:12 ` Alexei Starovoitov
2020-12-02 23:14 ` Andrii Nakryiko
2020-12-02 0:16 ` [PATCH v4 bpf-next 11/14] libbpf: factor out low-level BPF program loading helper Andrii Nakryiko
2020-12-02 0:16 ` [PATCH v4 bpf-next 12/14] libbpf: support attachment of BPF tracing programs to kernel modules Andrii Nakryiko
2020-12-02 0:16 ` [PATCH v4 bpf-next 13/14] selftests/bpf: add tp_btf CO-RE reloc test for modules Andrii Nakryiko
2020-12-02 0:16 ` [PATCH v4 bpf-next 14/14] selftests/bpf: add fentry/fexit/fmod_ret selftest for kernel module 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=20201202205809.qwbismdmmtrcsar7@ast-mbp \
--to=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@fb.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).