aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/module.h
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-01-29 17:13:22 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-01-29 01:13:23 -0500
commit6dd06c9fbe025f542bce4cdb91790c0f91962722 (patch)
tree5c946eb93f30c64fd435bdd6d1064880ef21557a /include/linux/module.h
parentbb9d3d56e792d2619cc0903df4ac01d86ac1261d (diff)
module: make module_address_lookup safe
module_address_lookup releases preemption then returns a pointer into the module space. The only user (kallsyms) copies the result, so just do that under the preempt disable. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux/module.h')
-rw-r--r--include/linux/module.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index c97bdb7eb957..aedc06be1de8 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -446,11 +446,14 @@ static inline void __module_get(struct module *module)
446 __mod ? __mod->name : "kernel"; \ 446 __mod ? __mod->name : "kernel"; \
447}) 447})
448 448
449/* For kallsyms to ask for address resolution. NULL means not found. */ 449/* For kallsyms to ask for address resolution. namebuf should be at
450const char *module_address_lookup(unsigned long addr, 450 * least KSYM_NAME_LEN long: a pointer to namebuf is returned if
451 unsigned long *symbolsize, 451 * found, otherwise NULL. */
452 unsigned long *offset, 452char *module_address_lookup(unsigned long addr,
453 char **modname); 453 unsigned long *symbolsize,
454 unsigned long *offset,
455 char **modname,
456 char *namebuf);
454int lookup_module_symbol_name(unsigned long addr, char *symname); 457int lookup_module_symbol_name(unsigned long addr, char *symname);
455int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name); 458int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
456 459
@@ -516,10 +519,11 @@ static inline void module_put(struct module *module)
516#define module_name(mod) "kernel" 519#define module_name(mod) "kernel"
517 520
518/* For kallsyms to ask for address resolution. NULL means not found. */ 521/* For kallsyms to ask for address resolution. NULL means not found. */
519static inline const char *module_address_lookup(unsigned long addr, 522static inline char *module_address_lookup(unsigned long addr,
520 unsigned long *symbolsize, 523 unsigned long *symbolsize,
521 unsigned long *offset, 524 unsigned long *offset,
522 char **modname) 525 char **modname,
526 char *namebuf)
523{ 527{
524 return NULL; 528 return NULL;
525} 529}