]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
kallsyms: Make module_kallsyms_on_each_symbol generally available
authorJiri Olsa <jolsa@kernel.org>
Thu, 11 Jan 2024 21:43:53 +0000 (22:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Jan 2024 17:51:26 +0000 (18:51 +0100)
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@lst.de>
Acked-by: Song Liu <song@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20221025134148.3300700-2-jolsa@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 926fe783c8a6 ("tracing/kprobes: Fix symbol counting logic by looking at modules as well")
Signed-off-by: Markus Boehme <markubo@amazon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/module.h
kernel/module.c

index c9f1200b23121a4199ca9fad1d97ce0d6a6c84ad..701c150485b2f4eb02522d0cb5955a566f3886bb 100644 (file)
@@ -867,8 +867,17 @@ static inline bool module_sig_ok(struct module *module)
 }
 #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 */
index 3c90840133c0e24568d8067adba38d3d4c883506..ba9f2bb57889cbc70e9b08eb05e913f18dde3343 100644 (file)
@@ -4482,7 +4482,6 @@ unsigned long module_kallsyms_lookup_name(const char *name)
        return ret;
 }
 
-#ifdef CONFIG_LIVEPATCH
 int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
                                             struct module *, unsigned long),
                                   void *data)
@@ -4514,7 +4513,6 @@ out:
        mutex_unlock(&module_mutex);
        return ret;
 }
-#endif /* CONFIG_LIVEPATCH */
 #endif /* CONFIG_KALLSYMS */
 
 static void cfi_init(struct module *mod)