[PATCH v3 3/3] module/kallsyms: enable indexed text lookup for livepatch modules
From: Stanislaw Gruszka
Date: Wed Nov 18 2026 - 09:51:51 EST
is_core_symbol() returns early for livepatch modules, preventing their
core text symbols from entering the sorted index. Address lookup
therefore falls back to a linear scan.
Allow eligible core text symbols to be indexed while preserving all
livepatch symbols, so core text address lookups can use binary search.
Signed-off-by: Stanislaw Gruszka <stf_xl@xxxxx>
---
kernel/module/kallsyms.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/kernel/module/kallsyms.c b/kernel/module/kallsyms.c
index 4e7a1c5a3b8b..8f8ac540ab5f 100644
--- a/kernel/module/kallsyms.c
+++ b/kernel/module/kallsyms.c
@@ -82,17 +82,18 @@ static unsigned int is_core_symbol(struct module *mod,
{
const Elf_Shdr *sec;
enum mod_mem_type type;
+ bool is_lp = is_livepatch_module(mod);
- if (symnum == 0 || is_livepatch_module(mod))
+ if (symnum == 0)
return 1;
if (src->st_shndx == SHN_UNDEF ||
src->st_shndx >= info->hdr->e_shnum ||
!src->st_name)
- return 0;
+ return is_lp;
if (is_ignored_kernel_symbol(&info->strtab[src->st_name]))
- return 0;
+ return is_lp;
#ifdef CONFIG_KALLSYMS_ALL
if (src->st_shndx == info->index.pcpu)
@@ -106,7 +107,7 @@ static unsigned int is_core_symbol(struct module *mod,
|| !(sec->sh_flags & SHF_EXECINSTR)
#endif
|| mod_mem_type_is_init(type))
- return 0;
+ return is_lp;
return 1 << (type == MOD_TEXT);
}
--
2.52.0