summaryrefslogtreecommitdiff
path: root/kernel/livepatch/core.c
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2023-01-19 17:07:15 -0800
committerAlexei Starovoitov <ast@kernel.org>2023-01-19 17:07:50 -0800
commit00b8f39f1d15c7e16e3f5ca7538f522f3a89131f (patch)
tree143f3ba40e705b2c470f90c491ecd38935581482 /kernel/livepatch/core.c
parent92afc5329a5b23d876b215b783d200352d5aaea6 (diff)
parent6a5f2d6ee8d515d5912e33d63a7386d03854a655 (diff)
Merge branch 'kallsyms: Optimize the search for module symbols by livepatch and bpf'
Jiri Olsa says: ==================== hi, sending new version of [1] patchset posted originally by Zhen Lei. It contains 2 changes that improove search performance for livepatch and bpf. v3 changes: - fixed off by 1 issue, simplified condition, added acks [Song] - added module attach as subtest [Andrii] v2 changes: - reworked the bpf change and meassured the performance - adding new selftest to benchmark kprobe multi module attachment - skipping patch 3 as requested by Zhen Lei - added Reviewed-by for patch 1 [Petr Mladek] thanks, jirka [1] https://lore.kernel.org/bpf/20221230112729.351-1-thunder.leizhen@huawei.com/ --- Jiri Olsa (2): selftests/bpf: Add serial_test_kprobe_multi_bench_attach_kernel/module tests bpf: Change modules resolving for kprobe multi link ==================== Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/livepatch/core.c')
-rw-r--r--kernel/livepatch/core.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index 201f0c0482fb5..c973ed9e42f81 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -118,7 +118,6 @@ static struct klp_object *klp_find_object(struct klp_patch *patch,
}
struct klp_find_arg {
- const char *objname;
const char *name;
unsigned long addr;
unsigned long count;
@@ -148,15 +147,9 @@ static int klp_find_callback(void *data, const char *name,
{
struct klp_find_arg *args = data;
- if ((mod && !args->objname) || (!mod && args->objname))
- return 0;
-
if (strcmp(args->name, name))
return 0;
- if (args->objname && strcmp(args->objname, mod->name))
- return 0;
-
return klp_match_callback(data, addr);
}
@@ -164,7 +157,6 @@ static int klp_find_object_symbol(const char *objname, const char *name,
unsigned long sympos, unsigned long *addr)
{
struct klp_find_arg args = {
- .objname = objname,
.name = name,
.addr = 0,
.count = 0,
@@ -172,7 +164,7 @@ static int klp_find_object_symbol(const char *objname, const char *name,
};
if (objname)
- module_kallsyms_on_each_symbol(klp_find_callback, &args);
+ module_kallsyms_on_each_symbol(objname, klp_find_callback, &args);
else
kallsyms_on_each_match_symbol(klp_match_callback, name, &args);