mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 13:41:30 +00:00
Fix race between cat /proc/slab_allocators and rmmod
Same story as with cat /proc/*/wchan race vs rmmod race, only /proc/slab_allocators want more info than just symbol name. Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru> Acked-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
9d65cb4a17
commit
a5c43dae7a
5 changed files with 61 additions and 7 deletions
|
@ -2149,6 +2149,33 @@ out:
|
|||
return -ERANGE;
|
||||
}
|
||||
|
||||
int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size,
|
||||
unsigned long *offset, char *modname, char *name)
|
||||
{
|
||||
struct module *mod;
|
||||
|
||||
mutex_lock(&module_mutex);
|
||||
list_for_each_entry(mod, &modules, list) {
|
||||
if (within(addr, mod->module_init, mod->init_size) ||
|
||||
within(addr, mod->module_core, mod->core_size)) {
|
||||
const char *sym;
|
||||
|
||||
sym = get_ksymbol(mod, addr, size, offset);
|
||||
if (!sym)
|
||||
goto out;
|
||||
if (modname)
|
||||
strlcpy(modname, mod->name, MODULE_NAME_LEN + 1);
|
||||
if (name)
|
||||
strlcpy(name, sym, KSYM_NAME_LEN + 1);
|
||||
mutex_unlock(&module_mutex);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
out:
|
||||
mutex_unlock(&module_mutex);
|
||||
return -ERANGE;
|
||||
}
|
||||
|
||||
int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
|
||||
char *name, char *module_name, int *exported)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue