History

module, bpf: Store BTF base pointer in struct module

...as this will allow split BTF modules with a base BTF representation (rather than the full vmlinux BTF at time of BTF encoding) to resolve their references to kernel types in a way that is more resilient to small changes in kernel types. This will allow modules that are not built every time the kernel is to provide more resilient BTF, rather than have it invalidated every time BTF ids for core kernel types change. Fields are ordered to avoid holes in struct module.

Alan Maguire committed 2 years ago

Commit d4e48e31 parent d1cf8402 files · +6 −1Browse files

Showing the changes to kernel/module (1 of 2 files). Show all

Unified · Split

kernel/module/main.c+4−1
@@ -2166,6 +2166,8 @@ static int find_module_sections(struct module *mod, struct load_info *info) · 2165 unmodified lines
21662166 #endif
21672167 #ifdef CONFIG_DEBUG_INFO_BTF_MODULES
21682168 mod->btf_data = any_section_objs(info, ".BTF", 1, &mod->btf_data_size);
2169+ mod->btf_base_data = any_section_objs(info, ".BTF.base", 1,
2170+ &mod->btf_base_data_size);
21692171 #endif
21702172 #ifdef CONFIG_JUMP_LABEL
21712173 mod->jump_entries = section_objs(info, "__jump_table",
@@ -2590,8 +2592,9 @@ static noinline int do_init_module(struct module *mod) · 418 unmodified lines
25902592 }
25912593
25922594 #ifdef CONFIG_DEBUG_INFO_BTF_MODULES
2593− /* .BTF is not SHF_ALLOC and will get removed, so sanitize pointer */
2595+ /* .BTF is not SHF_ALLOC and will get removed, so sanitize pointers */
25942596 mod->btf_data = NULL;
2597+ mod->btf_base_data = NULL;
25952598 #endif
25962599 /*
25972600 * We want to free module_init, but be aware that kallsyms may be