Split BPF Type Format (BTF) information for modules provides a major space saving, but if a module is built less frequently than the underlying kernel which it bases its BTF upon, the associated references become invalid and either the module will fail to load (CONFIG_BTF_ALLOW_MODULE_MISMATCH=n) or it will load without BTF available in /sys/kernel/btf (CONFIG_BTF_ALLOW_MODULE_MISMATCH=y). This problem was first raised in [1], so there is more discussion there. This series represents a simple proof-of-concept for handling standalone BTF - where the BTF for the module is not generated relative to base vmlinux BTF. The core problem with this is that all the tooling presumes split BTF for modules, so on module BTF load, we rework the BTF to appear as split BTF. It does not change in form - it still is only self-referential - but is compatible with split BTF interpretation. Building a module with standalone BTF is done via make BTF_BASE= M=path/2/module The detection of standalone BTF on module load is likely much too simplistic - we simply fall back to assuming standalone BTF if the BTF associated with the module appears to be invalid. However this approach seems to work well in practice. Tests etc are needed but wanted to get the proof-of-concept out for others to provide feedback early. [1] https://lore.kernel.org/bpf/YfK18x%2FXrYL4Vw8o@syu-laptop/ Alan Maguire (2): bpf: support standalone BTF in modules bpf: allow opt-out from using split BTF for modules kernel/bpf/btf.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++ scripts/Makefile.modfinal | 4 +- 2 files changed, 135 insertions(+), 1 deletion(-) -- 1.8.3.1