]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Assign ID to vmlinux BTF and return extra info for BTF in GET_OBJ_INFO
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 10 Nov 2020 01:19:29 +0000 (17:19 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 10 Nov 2020 23:25:53 +0000 (15:25 -0800)
commit371e9d5c1e9feb9e9e7794c6fd2f2e00cc1a6db5
tree57113db646325ea0474afcd3e2dc93adbd4c5c43
parent49cf9ad4e9be35493bee790cae35c61cf521b754
bpf: Assign ID to vmlinux BTF and return extra info for BTF in GET_OBJ_INFO

Allocate ID for vmlinux BTF. This makes it visible when iterating over all BTF
objects in the system. To allow distinguishing vmlinux BTF (and later kernel
module BTF) from user-provided BTFs, expose extra kernel_btf flag, as well as
BTF name ("vmlinux" for vmlinux BTF, will equal to module's name for module
BTF).  We might want to later allow specifying BTF name for user-provided BTFs
as well, if that makes sense. But currently this is reserved only for
in-kernel BTFs.

Having in-kernel BTFs exposed IDs will allow to extend BPF APIs that require
in-kernel BTF type with ability to specify BTF types from kernel modules, not
just vmlinux BTF. This will be implemented in a follow up patch set for
fentry/fexit/fmod_ret/lsm/etc.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20201110011932.3201430-3-andrii@kernel.org
include/uapi/linux/bpf.h
kernel/bpf/btf.c
tools/include/uapi/linux/bpf.h