History

Merge tag 'modules-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux

Pull modules updates from Luis Chamberlain: "Tux gets for xmas an improvement to the average lookup performance of kallsyms_lookup_name() by 715x thanks to the work by Zhen Lei, which upgraded our old implementation from being O(n) to O(log(n)), while also retaining the old implementation support on /proc/kallsyms. The only penalty was increasing the memory footprint by 3 * kallsyms_num_syms. Folks who want to improve this further now also have a dedicated selftest facility through KALLSYMS_SELFTEST. Stephen Boyd added zstd in-kernel decompression support, but the only users of this would be folks using the load-pin LSM because otherwise we do module decompression in userspace. The only other thing with mentioning is a minor boot time optimization by Rasmus Villemoes which deferes param_sysfs_init() to late init. The rest is cleanups and minor fixes" * tag 'modules-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux: livepatch: Call klp_match_callback() in klp_find_callback() to avoid code duplication module/decompress: Support zstd in-kernel decompression kallsyms: Remove unneeded semicolon kallsyms: Add self-test facility livepatch: Use kallsyms_on_each_match_symbol() to improve performance kallsyms: Add helper kallsyms_on_each_match_symbol() kallsyms: Reduce the memory occupied by kallsyms_seqs_of_names[] kallsyms: Correctly sequence symbols when CONFIG_LTO_CLANG=y kallsyms: Improve the performance of kallsyms_lookup_name() scripts/kallsyms: rename build_initial_tok_table() module: Fix NULL vs IS_ERR checking for module_get_next_page kernel/params.c: defer most of param_sysfs_init() to late_initcall time module: Remove unused macros module_addr_min/max module: remove redundant module_sysfs_initialized variable

Linus Torvalds committed 3 years ago

Commit 3ba2c3f2 parents 0015edd 4f1354d16 files · +840 −43Browse files

Showing the changes to kernel/livepatch (1 of 16 files). Show all

Unified · Split

kernel/livepatch/core.c+19−12
@@ -125,20 +125,10 @@ struct klp_find_arg { · 124 unmodified lines
125 unsigned long pos;125 unsigned long pos;
126};126};
127 127
128static int klp_find_callback(void *data, const char *name,128static int klp_match_callback(void *data, unsigned long addr)
129 struct module *mod, unsigned long addr)
130{129{
131 struct klp_find_arg *args = data;130 struct klp_find_arg *args = data;
132 131
133 if ((mod && !args->objname) || (!mod && args->objname))
134 return 0;
135
136 if (strcmp(args->name, name))
137 return 0;
138
139 if (args->objname && strcmp(args->objname, mod->name))
140 return 0;
141
142 args->addr = addr;132 args->addr = addr;
143 args->count++;133 args->count++;
144 134
@@ -153,6 +143,23 @@ static int klp_find_callback(void *data, const char *name, · 8 unmodified lines
153 return 0;143 return 0;
154}144}
155 145
146static int klp_find_callback(void *data, const char *name,
147 struct module *mod, unsigned long addr)
148{
149 struct klp_find_arg *args = data;
150
151 if ((mod && !args->objname) || (!mod && args->objname))
152 return 0;
153
154 if (strcmp(args->name, name))
155 return 0;
156
157 if (args->objname && strcmp(args->objname, mod->name))
158 return 0;
159
160 return klp_match_callback(data, addr);
161}
162
156static int klp_find_object_symbol(const char *objname, const char *name,163static int klp_find_object_symbol(const char *objname, const char *name,
157 unsigned long sympos, unsigned long *addr)164 unsigned long sympos, unsigned long *addr)
158{165{
@@ -167,7 +174,7 @@ static int klp_find_object_symbol(const char *objname, const char *name, · 8 unmodified lines
167 if (objname)174 if (objname)
168 module_kallsyms_on_each_symbol(klp_find_callback, &args);175 module_kallsyms_on_each_symbol(klp_find_callback, &args);
169 else176 else
170 kallsyms_on_each_symbol(klp_find_callback, &args);177 kallsyms_on_each_match_symbol(klp_match_callback, name, &args);
171 178
172 /*179 /*
173 * Ensure an address was found. If sympos is 0, ensure symbol is unique;180 * Ensure an address was found. If sympos is 0, ensure symbol is unique;