This is a note to let you know that I've just added the patch titled kallsyms: Make module_kallsyms_on_each_symbol generally available to the 6.0-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: kallsyms-make-module_kallsyms_on_each_symbol-generally-available.patch and it can be found in the queue-6.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From stable-owner@xxxxxxxxxxxxxxx Fri Dec 16 13:56:47 2022 From: Jiri Olsa <jolsa@xxxxxxxxxx> Date: Fri, 16 Dec 2022 13:56:21 +0100 Subject: kallsyms: Make module_kallsyms_on_each_symbol generally available To: stable@xxxxxxxxxxxxxxx Cc: Christoph Hellwig <hch@xxxxxx>, Song Liu <song@xxxxxxxxxx>, bpf@xxxxxxxxxxxxxxx, Martynas Pumputis <m@xxxxxxxxx> Message-ID: <20221216125628.1622505-2-jolsa@xxxxxxxxxx> From: Jiri Olsa <jolsa@xxxxxxxxxx> commit 73feb8d5fa3b755bb51077c0aabfb6aa556fd498 upstream. Making module_kallsyms_on_each_symbol generally available, so it can be used outside CONFIG_LIVEPATCH option in following changes. Rather than adding another ifdef option let's make the function generally available (when CONFIG_KALLSYMS and CONFIG_MODULES options are defined). Cc: Christoph Hellwig <hch@xxxxxx> Acked-by: Song Liu <song@xxxxxxxxxx> Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx> Link: https://lore.kernel.org/r/20221025134148.3300700-2-jolsa@xxxxxxxxxx Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- include/linux/module.h | 9 +++++++++ kernel/module/kallsyms.c | 2 -- 2 files changed, 9 insertions(+), 2 deletions(-) --- a/include/linux/module.h +++ b/include/linux/module.h @@ -879,8 +879,17 @@ static inline bool module_sig_ok(struct } #endif /* CONFIG_MODULE_SIG */ +#if defined(CONFIG_MODULES) && defined(CONFIG_KALLSYMS) int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, unsigned long), void *data); +#else +static inline int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, + struct module *, unsigned long), + void *data) +{ + return -EOPNOTSUPP; +} +#endif /* CONFIG_MODULES && CONFIG_KALLSYMS */ #endif /* _LINUX_MODULE_H */ --- a/kernel/module/kallsyms.c +++ b/kernel/module/kallsyms.c @@ -494,7 +494,6 @@ unsigned long module_kallsyms_lookup_nam return ret; } -#ifdef CONFIG_LIVEPATCH int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, unsigned long), void *data) @@ -531,4 +530,3 @@ out: mutex_unlock(&module_mutex); return ret; } -#endif /* CONFIG_LIVEPATCH */ Patches currently in stable-queue which might be from stable-owner@xxxxxxxxxxxxxxx are queue-6.0/ftrace-add-support-to-resolve-module-symbols-in-ftrace_lookup_symbols.patch queue-6.0/selftests-bpf-add-kprobe_multi-kmod-attach-api-tests.patch queue-6.0/bpf-take-module-reference-on-kprobe_multi-link.patch queue-6.0/selftests-bpf-add-load_kallsyms_refresh-function.patch queue-6.0/kallsyms-make-module_kallsyms_on_each_symbol-generally-available.patch queue-6.0/selftests-bpf-add-bpf_testmod_fentry_-functions.patch queue-6.0/selftests-bpf-add-kprobe_multi-check-to-module-attach-test.patch queue-6.0/bpf-rename-__bpf_kprobe_multi_cookie_cmp-to-bpf_kprobe_multi_addrs_cmp.patch