summaryrefslogtreecommitdiffstats
path: root/kernel/kallsyms.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@sw.ru>2007-05-08 00:28:47 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 11:15:08 -0700
commita5c43dae7ae38c2a6b3e9a819bcf45f010bf6a4a (patch)
treeb30da7a4541e803e35a6a74ad33e836442c3f6c8 /kernel/kallsyms.c
parent9d65cb4a1718a072898c7a57a3bc61b2dc4bcd4d (diff)
downloadlinux-a5c43dae7ae38c2a6b3e9a819bcf45f010bf6a4a.tar.gz
linux-a5c43dae7ae38c2a6b3e9a819bcf45f010bf6a4a.tar.bz2
linux-a5c43dae7ae38c2a6b3e9a819bcf45f010bf6a4a.zip
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>
Diffstat (limited to 'kernel/kallsyms.c')
-rw-r--r--kernel/kallsyms.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 4e2ec191a127..c36581b40c04 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -286,6 +286,25 @@ int lookup_symbol_name(unsigned long addr, char *symname)
return lookup_module_symbol_name(addr, symname);
}
+int lookup_symbol_attrs(unsigned long addr, unsigned long *size,
+ unsigned long *offset, char *modname, char *name)
+{
+ name[0] = '\0';
+ name[KSYM_NAME_LEN] = '\0';
+
+ if (is_ksym_addr(addr)) {
+ unsigned long pos;
+
+ pos = get_symbol_pos(addr, size, offset);
+ /* Grab name */
+ kallsyms_expand_symbol(get_symbol_offset(pos), name);
+ modname[0] = '\0';
+ return 0;
+ }
+ /* see if it's in a module */
+ return lookup_module_symbol_attrs(addr, size, offset, modname, name);
+}
+
/* Look up a kernel symbol and return it in a text buffer. */
int sprint_symbol(char *buffer, unsigned long address)
{