bpf: Add in-kernel split BTF support
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 10 Nov 2020 01:19:28 +0000 (17:19 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 10 Nov 2020 23:25:53 +0000 (15:25 -0800)
commit951bb64621b8139c0cd99dcadc13e6510c08aa73
treeeea9d87e4ed74fa1b07b1aec7c5820c037ed6c78
parentf52b8fd332573106e60958617a3d2e30611ce1fb
bpf: Add in-kernel split BTF support

Adjust in-kernel BTF implementation to support a split BTF mode of operation.
Changes are mostly mirroring libbpf split BTF changes, with the exception of
start_id being 0 for in-kernel implementation due to simpler read-only mode.

Otherwise, for split BTF logic, most of the logic of jumping to base BTF,
where necessary, is encapsulated in few helper functions. Type numbering and
string offset in a split BTF are logically continuing where base BTF ends, so
most of the high-level logic is kept without changes.

Type verification and size resolution is only doing an added resolution of new
split BTF types and relies on already cached size and type resolution results
in the base BTF.

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-2-andrii@kernel.org
kernel/bpf/btf.c