[PATCH 0/3] kallsyms: Optimize the search for module symbols by livepatch and bpf

From: Zhen Lei
Date: Fri Dec 30 2022 - 06:29:12 EST


Patches 7-8 in [1] have been delayed until now due to merge conflicts. The
current patch 1/3 corresponds to patch 7/9 in [1], and the current patch 3/3
corresponds to patch 8/9 in [1]. But there are some changes. Originally, only
livepatch uses function module_kallsyms_on_each_symbol(), it find the specified
function for the specified module. Now, bpf also uses function
module_kallsyms_on_each_symbol(), it needs to traverse all the modules. So for
the new parameter 'modname' of module_kallsyms_on_each_symbol(), if it's NULL,
the symbols of all modules are still traversed for compatibility with the case
of bpf.

Patch 2/3 is new, as I understand it, it should be fine. If it doesn't work,
then patch 3/3 should be dropped.

[1] https://lkml.org/lkml/2022/11/2/225

Zhen Lei (3):
livepatch: Improve the search performance of
module_kallsyms_on_each_symbol()
bpf: Optimize get_modules_for_addrs()
kallsyms: Delete an unused parameter related to
{module_}kallsyms_on_each_symbol()

include/linux/kallsyms.h | 3 +-
include/linux/module.h | 8 +--
kernel/kallsyms.c | 5 +-
kernel/kallsyms_selftest.c | 6 +--
kernel/livepatch/core.c | 13 +----
kernel/module/kallsyms.c | 16 ++++--
kernel/trace/bpf_trace.c | 101 +++++++++++++++----------------------
kernel/trace/ftrace.c | 5 +-
8 files changed, 67 insertions(+), 90 deletions(-)

--
2.25.1