[SRU][R][PATCH 0/1] Enable BTF generation for out-of-tree module builds when kernel dbgsyms are installed

Jacob Martin jacob.martin at canonical.com
Tue Mar 17 21:18:48 UTC 2026


BugLink: https://bugs.launchpad.net/bugs/2133794

[Impact]

When building out-of-tree kernel modules (via DKMS or manual module
build) on systems with the debuginfo package (`linux-image-*-dbgsym`)
installed, BTF (BPF Type Format) generation is skipped due to 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] dbgsym: add vmlinux symlink to headers
directory" resolves this issue by including a symlink to the vmlinux at
/usr/src/linux-headers-7.0.0-xx-generic/vmlinux in the
linux-image-7.0.0-xx-generic-dbgsym package.

[Test Plan]

Verify that BTF generation succeeds:

1. Install dbgsym and headers for the target kernel.

$ sudo apt install linux-image-7.0.0-xx-generic-dbgsym linux-headers-7.0.0-xx-generic-dbgsym

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 Ubuntu dbgsym packaging. An issue with this fix could
result in a malformed dbgsym package. On systems with the dbgsym package
installed, built out-of-tree kernel modules will now include an
additional .BTF section, which is already true for in-tree kernel
modules.

Jacob Martin (1):
  UBUNTU: [Packaging] dbgsym: add vmlinux symlink to headers directory

 debian/rules.d/2-binary-arch.mk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

-- 
2.43.0




More information about the kernel-team mailing list