From: Andrii Nakryiko Date: Thu, 5 Mar 2026 22:53:37 +0000 (-0800) Subject: Merge branch 'libbpf-bpftool-support-merging-split-btfs' X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8a2a3aaf90cf671caaca88fe57362c8b169ef392;p=thirdparty%2Flinux.git Merge branch 'libbpf-bpftool-support-merging-split-btfs' Josef Bacik says: ==================== libbpf/bpftool: support merging split BTFs v1: https://lore.kernel.org/bpf/cover.1771605821.git.josef@toxicpanda.com/ v2: https://lore.kernel.org/bpf/cover.1771616227.git.josef@toxicpanda.com/ v3: https://lore.kernel.org/bpf/cover.1771622266.git.josef@toxicpanda.com/ v4: https://lore.kernel.org/bpf/cover.1771625484.git.josef@toxicpanda.com/ v5: https://lore.kernel.org/bpf/cover.1771950922.git.josef@toxicpanda.com/ v1->v2: - Added a btf__dedup() call to btf__add_btf() to ensure that we don't have duplicate types in the merged BTF. v2->v3: - AI review got confused about the UAF comment, so the comment was expanded to clarify the UAF potential. - Fixed potential clobbering of errno in the error path. v3->v4: - Fixed a potential silent corruption pointed out by the AI review bot. v4->v5: - Addressed Andrii's comments for 1/3. - Addressed Alan and Quentin's comments for 2/3. - Addressed Alan's comments for 3/3. - Added my Signed-off-by for the third patch. - Made sure to validate everything still worked. v5->v6: - Fixed the missed is_prefix comment. - Fixed the removed warning about skipping vmlinux. --- Original email --- Hello, I'm extending systing to do introspection on vfio devices, which requires having the structs I need from the kernel available in userspace. Normally these are loadable modules, but in the case of vfio there's multiple structs across multiple modules. Normally you'd do the following to generate your vmlinux.h with a module bpftool btf dump file /sys/kernel/btf/ format c \ --base /sys/kernel/btf/vmlinux > vmlinux.h but if you need multiple modules you have to hack together multiple dumps and merge them together. This patch series adds support for merging multiple BTF sources together, so you can do bpftool btf dump file /sys/kernel/btf/ \ file /sys/kernel/btf/ format c \ --base /sys/kernel/btf/vmlinux > vmlinux.h I tested this with my usecase and it works. Thanks, Josef ==================== Link: https://patch.msgid.link/cover.1772657690.git.josef@toxicpanda.com Signed-off-by: Andrii Nakryiko --- 8a2a3aaf90cf671caaca88fe57362c8b169ef392