diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/module.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/kernel/module.c b/kernel/module.c index 8c6b42840dd1..5d2d28197c82 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -2062,6 +2062,12 @@ static void dynamic_debug_setup(struct _ddebug *debug, unsigned int num) | |||
| 2062 | #endif | 2062 | #endif |
| 2063 | } | 2063 | } |
| 2064 | 2064 | ||
| 2065 | static void dynamic_debug_remove(struct _ddebug *debug) | ||
| 2066 | { | ||
| 2067 | if (debug) | ||
| 2068 | ddebug_remove_module(debug->modname); | ||
| 2069 | } | ||
| 2070 | |||
| 2065 | static void *module_alloc_update_bounds(unsigned long size) | 2071 | static void *module_alloc_update_bounds(unsigned long size) |
| 2066 | { | 2072 | { |
| 2067 | void *ret = module_alloc(size); | 2073 | void *ret = module_alloc(size); |
| @@ -2124,6 +2130,8 @@ static noinline struct module *load_module(void __user *umod, | |||
| 2124 | void *ptr = NULL; /* Stops spurious gcc warning */ | 2130 | void *ptr = NULL; /* Stops spurious gcc warning */ |
| 2125 | unsigned long symoffs, stroffs, *strmap; | 2131 | unsigned long symoffs, stroffs, *strmap; |
| 2126 | void __percpu *percpu; | 2132 | void __percpu *percpu; |
| 2133 | struct _ddebug *debug = NULL; | ||
| 2134 | unsigned int num_debug = 0; | ||
| 2127 | 2135 | ||
| 2128 | mm_segment_t old_fs; | 2136 | mm_segment_t old_fs; |
| 2129 | 2137 | ||
| @@ -2476,15 +2484,9 @@ static noinline struct module *load_module(void __user *umod, | |||
| 2476 | kfree(strmap); | 2484 | kfree(strmap); |
| 2477 | strmap = NULL; | 2485 | strmap = NULL; |
| 2478 | 2486 | ||
| 2479 | if (!mod->taints) { | 2487 | if (!mod->taints) |
| 2480 | struct _ddebug *debug; | ||
| 2481 | unsigned int num_debug; | ||
| 2482 | |||
| 2483 | debug = section_objs(hdr, sechdrs, secstrings, "__verbose", | 2488 | debug = section_objs(hdr, sechdrs, secstrings, "__verbose", |
| 2484 | sizeof(*debug), &num_debug); | 2489 | sizeof(*debug), &num_debug); |
| 2485 | if (debug) | ||
| 2486 | dynamic_debug_setup(debug, num_debug); | ||
| 2487 | } | ||
| 2488 | 2490 | ||
| 2489 | err = module_finalize(hdr, sechdrs, mod); | 2491 | err = module_finalize(hdr, sechdrs, mod); |
| 2490 | if (err < 0) | 2492 | if (err < 0) |
| @@ -2526,10 +2528,13 @@ static noinline struct module *load_module(void __user *umod, | |||
| 2526 | goto unlock; | 2528 | goto unlock; |
| 2527 | } | 2529 | } |
| 2528 | 2530 | ||
| 2531 | if (debug) | ||
| 2532 | dynamic_debug_setup(debug, num_debug); | ||
| 2533 | |||
| 2529 | /* Find duplicate symbols */ | 2534 | /* Find duplicate symbols */ |
| 2530 | err = verify_export_symbols(mod); | 2535 | err = verify_export_symbols(mod); |
| 2531 | if (err < 0) | 2536 | if (err < 0) |
| 2532 | goto unlock; | 2537 | goto ddebug; |
| 2533 | 2538 | ||
| 2534 | list_add_rcu(&mod->list, &modules); | 2539 | list_add_rcu(&mod->list, &modules); |
| 2535 | mutex_unlock(&module_mutex); | 2540 | mutex_unlock(&module_mutex); |
| @@ -2557,6 +2562,8 @@ static noinline struct module *load_module(void __user *umod, | |||
| 2557 | mutex_lock(&module_mutex); | 2562 | mutex_lock(&module_mutex); |
| 2558 | /* Unlink carefully: kallsyms could be walking list. */ | 2563 | /* Unlink carefully: kallsyms could be walking list. */ |
| 2559 | list_del_rcu(&mod->list); | 2564 | list_del_rcu(&mod->list); |
| 2565 | ddebug: | ||
| 2566 | dynamic_debug_remove(debug); | ||
| 2560 | unlock: | 2567 | unlock: |
| 2561 | mutex_unlock(&module_mutex); | 2568 | mutex_unlock(&module_mutex); |
| 2562 | synchronize_sched(); | 2569 | synchronize_sched(); |
