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
2166#endif2166#endif
2167#ifdef CONFIG_DEBUG_INFO_BTF_MODULES2167#ifdef CONFIG_DEBUG_INFO_BTF_MODULES
2168 mod->btf_data = any_section_objs(info, ".BTF", 1, &mod->btf_data_size);2168 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);
2169#endif2171#endif
2170#ifdef CONFIG_JUMP_LABEL2172#ifdef CONFIG_JUMP_LABEL
2171 mod->jump_entries = section_objs(info, "__jump_table",2173 mod->jump_entries = section_objs(info, "__jump_table",
@@ -2590,8 +2592,9 @@ static noinline int do_init_module(struct module *mod) · 418 unmodified lines
2590 }2592 }
2591 2593
2592#ifdef CONFIG_DEBUG_INFO_BTF_MODULES2594#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 */
2594 mod->btf_data = NULL;2596 mod->btf_data = NULL;
2597 mod->btf_base_data = NULL;
2595#endif2598#endif
2596 /*2599 /*
2597 * We want to free module_init, but be aware that kallsyms may be2600 * We want to free module_init, but be aware that kallsyms may be