diff options
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/kernel/module.c b/kernel/module.c index f47cce910f25..496dcb57b608 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <linux/device.h> | 43 | #include <linux/device.h> |
44 | #include <linux/string.h> | 44 | #include <linux/string.h> |
45 | #include <linux/mutex.h> | 45 | #include <linux/mutex.h> |
46 | #include <linux/unwind.h> | ||
47 | #include <linux/rculist.h> | 46 | #include <linux/rculist.h> |
48 | #include <asm/uaccess.h> | 47 | #include <asm/uaccess.h> |
49 | #include <asm/cacheflush.h> | 48 | #include <asm/cacheflush.h> |
@@ -1449,8 +1448,6 @@ static void free_module(struct module *mod) | |||
1449 | remove_sect_attrs(mod); | 1448 | remove_sect_attrs(mod); |
1450 | mod_kobject_remove(mod); | 1449 | mod_kobject_remove(mod); |
1451 | 1450 | ||
1452 | unwind_remove_table(mod->unwind_info, 0); | ||
1453 | |||
1454 | /* Arch-specific cleanup. */ | 1451 | /* Arch-specific cleanup. */ |
1455 | module_arch_cleanup(mod); | 1452 | module_arch_cleanup(mod); |
1456 | 1453 | ||
@@ -1867,7 +1864,6 @@ static noinline struct module *load_module(void __user *umod, | |||
1867 | unsigned int symindex = 0; | 1864 | unsigned int symindex = 0; |
1868 | unsigned int strindex = 0; | 1865 | unsigned int strindex = 0; |
1869 | unsigned int modindex, versindex, infoindex, pcpuindex; | 1866 | unsigned int modindex, versindex, infoindex, pcpuindex; |
1870 | unsigned int unwindex = 0; | ||
1871 | unsigned int num_kp, num_mcount; | 1867 | unsigned int num_kp, num_mcount; |
1872 | struct kernel_param *kp; | 1868 | struct kernel_param *kp; |
1873 | struct module *mod; | 1869 | struct module *mod; |
@@ -1957,9 +1953,6 @@ static noinline struct module *load_module(void __user *umod, | |||
1957 | versindex = find_sec(hdr, sechdrs, secstrings, "__versions"); | 1953 | versindex = find_sec(hdr, sechdrs, secstrings, "__versions"); |
1958 | infoindex = find_sec(hdr, sechdrs, secstrings, ".modinfo"); | 1954 | infoindex = find_sec(hdr, sechdrs, secstrings, ".modinfo"); |
1959 | pcpuindex = find_pcpusec(hdr, sechdrs, secstrings); | 1955 | pcpuindex = find_pcpusec(hdr, sechdrs, secstrings); |
1960 | #ifdef ARCH_UNWIND_SECTION_NAME | ||
1961 | unwindex = find_sec(hdr, sechdrs, secstrings, ARCH_UNWIND_SECTION_NAME); | ||
1962 | #endif | ||
1963 | 1956 | ||
1964 | /* Don't keep modinfo and version sections. */ | 1957 | /* Don't keep modinfo and version sections. */ |
1965 | sechdrs[infoindex].sh_flags &= ~(unsigned long)SHF_ALLOC; | 1958 | sechdrs[infoindex].sh_flags &= ~(unsigned long)SHF_ALLOC; |
@@ -1969,8 +1962,6 @@ static noinline struct module *load_module(void __user *umod, | |||
1969 | sechdrs[symindex].sh_flags |= SHF_ALLOC; | 1962 | sechdrs[symindex].sh_flags |= SHF_ALLOC; |
1970 | sechdrs[strindex].sh_flags |= SHF_ALLOC; | 1963 | sechdrs[strindex].sh_flags |= SHF_ALLOC; |
1971 | #endif | 1964 | #endif |
1972 | if (unwindex) | ||
1973 | sechdrs[unwindex].sh_flags |= SHF_ALLOC; | ||
1974 | 1965 | ||
1975 | /* Check module struct version now, before we try to use module. */ | 1966 | /* Check module struct version now, before we try to use module. */ |
1976 | if (!check_modstruct_version(sechdrs, versindex, mod)) { | 1967 | if (!check_modstruct_version(sechdrs, versindex, mod)) { |
@@ -2267,11 +2258,6 @@ static noinline struct module *load_module(void __user *umod, | |||
2267 | add_sect_attrs(mod, hdr->e_shnum, secstrings, sechdrs); | 2258 | add_sect_attrs(mod, hdr->e_shnum, secstrings, sechdrs); |
2268 | add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs); | 2259 | add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs); |
2269 | 2260 | ||
2270 | /* Size of section 0 is 0, so this works well if no unwind info. */ | ||
2271 | mod->unwind_info = unwind_add_table(mod, | ||
2272 | (void *)sechdrs[unwindex].sh_addr, | ||
2273 | sechdrs[unwindex].sh_size); | ||
2274 | |||
2275 | /* Get rid of temporary copy */ | 2261 | /* Get rid of temporary copy */ |
2276 | vfree(hdr); | 2262 | vfree(hdr); |
2277 | 2263 | ||
@@ -2366,11 +2352,12 @@ sys_init_module(void __user *umod, | |||
2366 | /* Now it's a first class citizen! Wake up anyone waiting for it. */ | 2352 | /* Now it's a first class citizen! Wake up anyone waiting for it. */ |
2367 | mod->state = MODULE_STATE_LIVE; | 2353 | mod->state = MODULE_STATE_LIVE; |
2368 | wake_up(&module_wq); | 2354 | wake_up(&module_wq); |
2355 | blocking_notifier_call_chain(&module_notify_list, | ||
2356 | MODULE_STATE_LIVE, mod); | ||
2369 | 2357 | ||
2370 | mutex_lock(&module_mutex); | 2358 | mutex_lock(&module_mutex); |
2371 | /* Drop initial reference. */ | 2359 | /* Drop initial reference. */ |
2372 | module_put(mod); | 2360 | module_put(mod); |
2373 | unwind_remove_table(mod->unwind_info, 1); | ||
2374 | module_free(mod, mod->module_init); | 2361 | module_free(mod, mod->module_init); |
2375 | mod->module_init = NULL; | 2362 | mod->module_init = NULL; |
2376 | mod->init_size = 0; | 2363 | mod->init_size = 0; |
@@ -2405,7 +2392,7 @@ static const char *get_ksymbol(struct module *mod, | |||
2405 | unsigned long nextval; | 2392 | unsigned long nextval; |
2406 | 2393 | ||
2407 | /* At worse, next value is at end of module */ | 2394 | /* At worse, next value is at end of module */ |
2408 | if (within(addr, mod->module_init, mod->init_size)) | 2395 | if (within_module_init(addr, mod)) |
2409 | nextval = (unsigned long)mod->module_init+mod->init_text_size; | 2396 | nextval = (unsigned long)mod->module_init+mod->init_text_size; |
2410 | else | 2397 | else |
2411 | nextval = (unsigned long)mod->module_core+mod->core_text_size; | 2398 | nextval = (unsigned long)mod->module_core+mod->core_text_size; |
@@ -2453,8 +2440,8 @@ const char *module_address_lookup(unsigned long addr, | |||
2453 | 2440 | ||
2454 | preempt_disable(); | 2441 | preempt_disable(); |
2455 | list_for_each_entry_rcu(mod, &modules, list) { | 2442 | list_for_each_entry_rcu(mod, &modules, list) { |
2456 | if (within(addr, mod->module_init, mod->init_size) | 2443 | if (within_module_init(addr, mod) || |
2457 | || within(addr, mod->module_core, mod->core_size)) { | 2444 | within_module_core(addr, mod)) { |
2458 | if (modname) | 2445 | if (modname) |
2459 | *modname = mod->name; | 2446 | *modname = mod->name; |
2460 | ret = get_ksymbol(mod, addr, size, offset); | 2447 | ret = get_ksymbol(mod, addr, size, offset); |
@@ -2476,8 +2463,8 @@ int lookup_module_symbol_name(unsigned long addr, char *symname) | |||
2476 | 2463 | ||
2477 | preempt_disable(); | 2464 | preempt_disable(); |
2478 | list_for_each_entry_rcu(mod, &modules, list) { | 2465 | list_for_each_entry_rcu(mod, &modules, list) { |
2479 | if (within(addr, mod->module_init, mod->init_size) || | 2466 | if (within_module_init(addr, mod) || |
2480 | within(addr, mod->module_core, mod->core_size)) { | 2467 | within_module_core(addr, mod)) { |
2481 | const char *sym; | 2468 | const char *sym; |
2482 | 2469 | ||
2483 | sym = get_ksymbol(mod, addr, NULL, NULL); | 2470 | sym = get_ksymbol(mod, addr, NULL, NULL); |
@@ -2500,8 +2487,8 @@ int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, | |||
2500 | 2487 | ||
2501 | preempt_disable(); | 2488 | preempt_disable(); |
2502 | list_for_each_entry_rcu(mod, &modules, list) { | 2489 | list_for_each_entry_rcu(mod, &modules, list) { |
2503 | if (within(addr, mod->module_init, mod->init_size) || | 2490 | if (within_module_init(addr, mod) || |
2504 | within(addr, mod->module_core, mod->core_size)) { | 2491 | within_module_core(addr, mod)) { |
2505 | const char *sym; | 2492 | const char *sym; |
2506 | 2493 | ||
2507 | sym = get_ksymbol(mod, addr, size, offset); | 2494 | sym = get_ksymbol(mod, addr, size, offset); |
@@ -2720,7 +2707,7 @@ int is_module_address(unsigned long addr) | |||
2720 | preempt_disable(); | 2707 | preempt_disable(); |
2721 | 2708 | ||
2722 | list_for_each_entry_rcu(mod, &modules, list) { | 2709 | list_for_each_entry_rcu(mod, &modules, list) { |
2723 | if (within(addr, mod->module_core, mod->core_size)) { | 2710 | if (within_module_core(addr, mod)) { |
2724 | preempt_enable(); | 2711 | preempt_enable(); |
2725 | return 1; | 2712 | return 1; |
2726 | } | 2713 | } |