aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/kernel/module.c b/kernel/module.c
index ae79ce615cb9..03214bd288e9 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3304,6 +3304,11 @@ static int load_module(struct load_info *info, const char __user *uargs,
3304 mutex_lock(&module_mutex); 3304 mutex_lock(&module_mutex);
3305 module_bug_cleanup(mod); 3305 module_bug_cleanup(mod);
3306 mutex_unlock(&module_mutex); 3306 mutex_unlock(&module_mutex);
3307
3308 /* we can't deallocate the module until we clear memory protection */
3309 unset_module_init_ro_nx(mod);
3310 unset_module_core_ro_nx(mod);
3311
3307 ddebug_cleanup: 3312 ddebug_cleanup:
3308 dynamic_debug_remove(info->debug); 3313 dynamic_debug_remove(info->debug);
3309 synchronize_sched(); 3314 synchronize_sched();
@@ -3381,6 +3386,8 @@ static inline int within(unsigned long addr, void *start, unsigned long size)
3381 */ 3386 */
3382static inline int is_arm_mapping_symbol(const char *str) 3387static inline int is_arm_mapping_symbol(const char *str)
3383{ 3388{
3389 if (str[0] == '.' && str[1] == 'L')
3390 return true;
3384 return str[0] == '$' && strchr("atd", str[1]) 3391 return str[0] == '$' && strchr("atd", str[1])
3385 && (str[2] == '\0' || str[2] == '.'); 3392 && (str[2] == '\0' || str[2] == '.');
3386} 3393}
@@ -3444,8 +3451,7 @@ const char *module_address_lookup(unsigned long addr,
3444 list_for_each_entry_rcu(mod, &modules, list) { 3451 list_for_each_entry_rcu(mod, &modules, list) {
3445 if (mod->state == MODULE_STATE_UNFORMED) 3452 if (mod->state == MODULE_STATE_UNFORMED)
3446 continue; 3453 continue;
3447 if (within_module_init(addr, mod) || 3454 if (within_module(addr, mod)) {
3448 within_module_core(addr, mod)) {
3449 if (modname) 3455 if (modname)
3450 *modname = mod->name; 3456 *modname = mod->name;
3451 ret = get_ksymbol(mod, addr, size, offset); 3457 ret = get_ksymbol(mod, addr, size, offset);
@@ -3469,8 +3475,7 @@ int lookup_module_symbol_name(unsigned long addr, char *symname)
3469 list_for_each_entry_rcu(mod, &modules, list) { 3475 list_for_each_entry_rcu(mod, &modules, list) {
3470 if (mod->state == MODULE_STATE_UNFORMED) 3476 if (mod->state == MODULE_STATE_UNFORMED)
3471 continue; 3477 continue;
3472 if (within_module_init(addr, mod) || 3478 if (within_module(addr, mod)) {
3473 within_module_core(addr, mod)) {
3474 const char *sym; 3479 const char *sym;
3475 3480
3476 sym = get_ksymbol(mod, addr, NULL, NULL); 3481 sym = get_ksymbol(mod, addr, NULL, NULL);
@@ -3495,8 +3500,7 @@ int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size,
3495 list_for_each_entry_rcu(mod, &modules, list) { 3500 list_for_each_entry_rcu(mod, &modules, list) {
3496 if (mod->state == MODULE_STATE_UNFORMED) 3501 if (mod->state == MODULE_STATE_UNFORMED)
3497 continue; 3502 continue;
3498 if (within_module_init(addr, mod) || 3503 if (within_module(addr, mod)) {
3499 within_module_core(addr, mod)) {
3500 const char *sym; 3504 const char *sym;
3501 3505
3502 sym = get_ksymbol(mod, addr, size, offset); 3506 sym = get_ksymbol(mod, addr, size, offset);
@@ -3760,8 +3764,7 @@ struct module *__module_address(unsigned long addr)
3760 list_for_each_entry_rcu(mod, &modules, list) { 3764 list_for_each_entry_rcu(mod, &modules, list) {
3761 if (mod->state == MODULE_STATE_UNFORMED) 3765 if (mod->state == MODULE_STATE_UNFORMED)
3762 continue; 3766 continue;
3763 if (within_module_core(addr, mod) 3767 if (within_module(addr, mod))
3764 || within_module_init(addr, mod))
3765 return mod; 3768 return mod;
3766 } 3769 }
3767 return NULL; 3770 return NULL;