From: Stanislaw Gruszka <stf_xl@wp.pl>
To: linux-modules@vger.kernel.org,
Sami Tolvanen <samitolvanen@google.com>,
Luis Chamberlain <mcgrof@kernel.org>,
Petr Pavlu <petr.pavlu@suse.com>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
live-patching@vger.kernel.org, Daniel Gomez <da.gomez@kernel.org>,
Aaron Tomlin <atomlin@atomlin.com>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Jordan Rome <linux@jordanrome.com>,
Viktor Malik <vmalik@redhat.com>, Petr Mladek <pmladek@suse.com>
Subject: [PATCH v3 3/3] module/kallsyms: enable indexed text lookup for livepatch modules
Date: Wed, 18 Nov 2026 15:51:25 +0100 [thread overview]
Message-ID: <20261118145125.29399-4-stf_xl@wp.pl> (raw)
In-Reply-To: <20261118145125.29399-1-stf_xl@wp.pl>
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@wp.pl>
---
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
prev parent reply other threads:[~2026-11-18 14:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 14:51 [PATCH v3 0/3] module/kallsyms: sort function symbols and use binary search Stanislaw Gruszka
2026-11-18 14:51 ` [PATCH v3 1/3] module/kallsyms: include empty names in is_ignored_kernel_symbol() Stanislaw Gruszka
2026-11-18 14:51 ` [PATCH v3 2/3] module/kallsyms: sort text symbol indices and use binary search Stanislaw Gruszka
2026-11-18 14:51 ` Stanislaw Gruszka [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261118145125.29399-4-stf_xl@wp.pl \
--to=stf_xl@wp.pl \
--cc=atomlin@atomlin.com \
--cc=da.gomez@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux@jordanrome.com \
--cc=live-patching@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=mhiramat@kernel.org \
--cc=petr.pavlu@suse.com \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=samitolvanen@google.com \
--cc=vmalik@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®