kallsyms: Make module_kallsyms_on_each_symbol generally available

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>
Stable-dep-of: 329197033bb0 ("tracing/kprobes: Fix symbol counting logic
by looking at modules as well")
Signed-off-by: Sherry Yang <sherry.yang@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Jiri Olsa 2024-10-08 15:29:46 -07:00 committed by Ksawlii
parent 9dc3580302
commit 7b296fe960
2 changed files with 9 additions and 2 deletions

View file

@ -892,8 +892,17 @@ static inline bool module_sig_ok(struct module *module)
} }
#endif /* CONFIG_MODULE_SIG */ #endif /* CONFIG_MODULE_SIG */
#if defined(CONFIG_MODULES) && defined(CONFIG_KALLSYMS)
int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
struct module *, unsigned long), struct module *, unsigned long),
void *data); 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 */ #endif /* _LINUX_MODULE_H */

View file

@ -4575,7 +4575,6 @@ unsigned long module_kallsyms_lookup_name(const char *name)
return ret; return ret;
} }
#ifdef CONFIG_LIVEPATCH
int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
struct module *, unsigned long), struct module *, unsigned long),
void *data) void *data)
@ -4606,7 +4605,6 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
mutex_unlock(&module_mutex); mutex_unlock(&module_mutex);
return ret; return ret;
} }
#endif /* CONFIG_LIVEPATCH */
#endif /* CONFIG_KALLSYMS */ #endif /* CONFIG_KALLSYMS */
static void cfi_init(struct module *mod) static void cfi_init(struct module *mod)