Right, fixed in v4 (patch 8/12, where the deferred reader is added): https://lore.kernel.org/bpf/[email protected]/
A dead entry now keeps its raw data only if its sysfs file serves it as is (sysfs_bin_attr_simple_read); for a .BTF.base module, whose reader fails with -ENODEV once the entry is gone and never touches the data, or without a sysfs file, the data is freed with the rest. Tested with a .BTF.base module whose .BTF is corrupted, loaded before the vmlinux BTF: its file fails with -ENODEV after the parse failure, rmmod is clean, and kmemleak reports nothing; the same module without .BTF.base keeps serving its raw bytes. Jay
