APPLIED: Re: [SRU][R][PATCH v2 0/1] Enable BTF generation for out-of-tree module builds

Timo Aaltonen timo.aaltonen at canonical.com
Thu Mar 26 20:47:36 UTC 2026


Jacob Martin kirjoitti 26.3.2026 klo 16.18:
> BugLink: https://bugs.launchpad.net/bugs/2133794
> 
> [Impact]
> 
> When building out-of-tree kernel modules (via DKMS or manual module
> build), BTF (BPF Type Format) generation is skipped due to a vmlinux not
> being found in the expected location. This prevents BPF-based tracing
> tools (bpftrace, BCC) from attaching kprobes/kfuncs to out-of-tree
> module functions.
> 
> [Fix]
> 
> The patch "UBUNTU: [Packaging] add stripped-down vmlinux with only BTF
> sections to flavour headers package" resolves this issue by including a
> stripped-down version of the vmlinux with only .BTF and .BTF_ids
> sections at /usr/src/linux-headers-7.0.0-xx-generic/vmlinux in the
> linux-headers-7.0.0-xx-<flavour> packages.
> 
> This solution matches the one in Debian by Bastian Blank:
> https://salsa.debian.org/kernel-team/linux/-/commit/0dedced119aea5426f81a9318c36e0a6c7339547.
> 
> [Test Plan]
> 
> Verify that BTF generation succeeds:
> 
> 1. Install headers for the target kernel.
> 
> $ sudo apt install linux-headers-7.0.0-xx-generic
> 
> 2. Obtain sources for a test kernel module.
> 
> $ git clone https://github.com/ivbakula/hello-world-kernel-module
> 
> 3. Build this kernel module.
> 
> make -C /lib/modules/7.0.0-xx-generic/build M=hello-world-kernel-module modules
> 
> 4. Verify BTF generation is successful.
> 
> $ objdump --section=.BTF -s ~/hello-world-kernel-module/hello.ko
> 
> /root/hello-world-kernel-module/hello.ko: file format elf64-x86-64
> 
> Contents of section .BTF:
>   0000 9feb0100 18000000 00000000 60000000 ............`...
>   0010 60000000 16000000 00000000 0000000a `...............
>   0020 02000000 00000000 00000003 00000000 ................
>   0030 03000000 01000000 05000000 00000000 ................
>   0040 0000000a 04000000 15000000 0000000c ................
>   0050 09000000 20000000 0000000c 08000000 .... ...........
>   0060 00000000 0000000d 01000000 00000000 ................
>   0070 0000000d 00000000 68656c6c 6f5f6578 ........hello_ex
>   0080 69740068 656c6c6f 5f696e69 7400 it.hello_init.
> 
> Note: if BTF generation is unsuccessful, the output will appear as:
> 
> $ objdump --section=.BTF -s hello.nobtf.ko
> 
> hello.nobtf.ko: file format elf64-x86-64
> 
> objdump: section '.BTF' mentioned in a -j option, but not found in any input file
> 
> [Where issues could occur]
> 
> This modifies the flavour-specific header package to include a
> stripped-down vmlinux with only .BTF and .BTF_ids sections. Issues could
> occur if software on the system assumes vmlinux at this path will be a
> full vmlinux, but finds the version with only .BTF and .BTF_ids
> sections. As a vmlinux file was not included in the headers at all
> before, it is unlikely existing functionality was relying on it.
> 
> [Other notes]
> 
> Changed in v2: Rather than rely on the dbgsyms package being installed,
> provide a stripped-down vmlinux file in the headers package, with only
> .BTF and .BTF_ids sections.
> 
> Jacob Martin (1):
>    UBUNTU: [Packaging] add stripped-down vmlinux with only BTF
>      sections to flavour headers package
> 
>   debian/rules.d/2-binary-arch.mk | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 

thanks, applied


-- 
Timo Aaltonen
Kernel Team
Canonical Ltd.



More information about the kernel-team mailing list