ANDROID: debug_symbols: Add android_debug_for_each_module
Allow vendors to obtain a list of modules loaded at given time. Vendor modules are able to register on part of notifier chain (register_module_notifer), but a vendor module would never see modules which are loaded before the one which registers on the notifier chain. The kernel doesn't offer load order control, so a hook is necessary to iterate through currently loaded kernel modules. Bug: 193552324 Change-Id: I3b01cc1b90f8c0c7c21a37992cc7d607316efc7b Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
This commit is contained in:
@@ -50,6 +50,9 @@ enum android_debug_per_cpu_symbol {
|
|||||||
void *android_debug_symbol(enum android_debug_symbol symbol);
|
void *android_debug_symbol(enum android_debug_symbol symbol);
|
||||||
void *android_debug_per_cpu_symbol(enum android_debug_per_cpu_symbol symbol);
|
void *android_debug_per_cpu_symbol(enum android_debug_per_cpu_symbol symbol);
|
||||||
|
|
||||||
|
void android_debug_for_each_module(int (*fn)(const char *mod_name, void *mod_addr, void *data),
|
||||||
|
void *data);
|
||||||
|
|
||||||
#else /* !CONFIG_ANDROID_DEBUG_SYMBOLS */
|
#else /* !CONFIG_ANDROID_DEBUG_SYMBOLS */
|
||||||
|
|
||||||
static inline void *android_debug_symbol(enum android_debug_symbol symbol)
|
static inline void *android_debug_symbol(enum android_debug_symbol symbol)
|
||||||
@@ -60,6 +63,9 @@ static inline void *android_debug_per_cpu_symbol(enum android_debug_per_cpu_symb
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void android_debug_for_each_module(int (*fn)(const char *mod_name, void *mod_addr,
|
||||||
|
void *data), void *data) {}
|
||||||
#endif /* CONFIG_ANDROID_DEBUG_SYMBOLS */
|
#endif /* CONFIG_ANDROID_DEBUG_SYMBOLS */
|
||||||
|
|
||||||
#endif /* _ANDROID_DEBUG_SYMBOLS_H */
|
#endif /* _ANDROID_DEBUG_SYMBOLS_H */
|
||||||
|
@@ -4788,6 +4788,23 @@ void print_modules(void)
|
|||||||
pr_cont("\n");
|
pr_cont("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ANDROID_DEBUG_SYMBOLS
|
||||||
|
void android_debug_for_each_module(int (*fn)(const char *mod_name, void *mod_addr, void *data),
|
||||||
|
void *data)
|
||||||
|
{
|
||||||
|
struct module *module;
|
||||||
|
|
||||||
|
preempt_disable();
|
||||||
|
list_for_each_entry_rcu(module, &modules, list) {
|
||||||
|
if (fn(module->name, module->core_layout.base, data))
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
out:
|
||||||
|
preempt_enable();
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(android_debug_for_each_module);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_MODVERSIONS
|
#ifdef CONFIG_MODVERSIONS
|
||||||
/* Generate the signature for all relevant module structures here.
|
/* Generate the signature for all relevant module structures here.
|
||||||
* If these change, we don't want to try to parse the module. */
|
* If these change, we don't want to try to parse the module. */
|
||||||
|
Reference in New Issue
Block a user