Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux

Pull module update from Rusty Russell:
"Trivial cleanups, mainly"

* tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
module: Replace over-engineered nested sleep
module: Annotate nested sleep in resolve_symbol()
module: Remove double spaces in module verification taint message
kernel/module.c: Free lock-classes if parse_args failed
module: set ksymtab/kcrctab* section addresses to 0x0

+28 -39
+18 -29
kernel/module.c
··· 1225 1225 const unsigned long *crc; 1226 1226 int err; 1227 1227 1228 + /* 1229 + * The module_mutex should not be a heavily contended lock; 1230 + * if we get the occasional sleep here, we'll go an extra iteration 1231 + * in the wait_event_interruptible(), which is harmless. 1232 + */ 1233 + sched_annotate_sleep(); 1228 1234 mutex_lock(&module_mutex); 1229 1235 sym = find_symbol(name, &owner, &crc, 1230 1236 !(mod->taints & (1 << TAINT_PROPRIETARY_MODULE)), true); ··· 2984 2978 struct module *mod; 2985 2979 bool ret; 2986 2980 2981 + /* 2982 + * The module_mutex should not be a heavily contended lock; 2983 + * if we get the occasional sleep here, we'll go an extra iteration 2984 + * in the wait_event_interruptible(), which is harmless. 2985 + */ 2986 + sched_annotate_sleep(); 2987 2987 mutex_lock(&module_mutex); 2988 2988 mod = find_module_all(name, strlen(name), true); 2989 2989 ret = !mod || mod->state == MODULE_STATE_LIVE ··· 3132 3120 } 3133 3121 3134 3122 /* 3135 - * Can't use wait_event_interruptible() because our condition 3136 - * 'finished_loading()' contains a blocking primitive itself (mutex_lock). 3137 - */ 3138 - static int wait_finished_loading(struct module *mod) 3139 - { 3140 - DEFINE_WAIT_FUNC(wait, woken_wake_function); 3141 - int ret = 0; 3142 - 3143 - add_wait_queue(&module_wq, &wait); 3144 - for (;;) { 3145 - if (finished_loading(mod->name)) 3146 - break; 3147 - 3148 - if (signal_pending(current)) { 3149 - ret = -ERESTARTSYS; 3150 - break; 3151 - } 3152 - 3153 - wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT); 3154 - } 3155 - remove_wait_queue(&module_wq, &wait); 3156 - 3157 - return ret; 3158 - } 3159 - 3160 - /* 3161 3123 * We try to place it in the list now to make sure it's unique before 3162 3124 * we dedicate too many resources. In particular, temporary percpu 3163 3125 * memory exhaustion. ··· 3151 3165 || old->state == MODULE_STATE_UNFORMED) { 3152 3166 /* Wait in case it fails to load. */ 3153 3167 mutex_unlock(&module_mutex); 3154 - 3155 - err = wait_finished_loading(mod); 3168 + err = wait_event_interruptible(module_wq, 3169 + finished_loading(mod->name)); 3156 3170 if (err) 3157 3171 goto out_unlocked; 3158 3172 goto again; ··· 3251 3265 mod->sig_ok = info->sig_ok; 3252 3266 if (!mod->sig_ok) { 3253 3267 pr_notice_once("%s: module verification failed: signature " 3254 - "and/or required key missing - tainting " 3268 + "and/or required key missing - tainting " 3255 3269 "kernel\n", mod->name); 3256 3270 add_taint_module(mod, TAINT_UNSIGNED_MODULE, LOCKDEP_STILL_OK); 3257 3271 } ··· 3341 3355 mutex_lock(&module_mutex); 3342 3356 module_bug_cleanup(mod); 3343 3357 mutex_unlock(&module_mutex); 3358 + 3359 + /* Free lock-classes: */ 3360 + lockdep_free_key_range(mod->module_core, mod->core_size); 3344 3361 3345 3362 /* we can't deallocate the module until we clear memory protection */ 3346 3363 unset_module_init_ro_nx(mod);
+10 -10
scripts/module-common.lds
··· 6 6 SECTIONS { 7 7 /DISCARD/ : { *(.discard) } 8 8 9 - __ksymtab : { *(SORT(___ksymtab+*)) } 10 - __ksymtab_gpl : { *(SORT(___ksymtab_gpl+*)) } 11 - __ksymtab_unused : { *(SORT(___ksymtab_unused+*)) } 12 - __ksymtab_unused_gpl : { *(SORT(___ksymtab_unused_gpl+*)) } 13 - __ksymtab_gpl_future : { *(SORT(___ksymtab_gpl_future+*)) } 14 - __kcrctab : { *(SORT(___kcrctab+*)) } 15 - __kcrctab_gpl : { *(SORT(___kcrctab_gpl+*)) } 16 - __kcrctab_unused : { *(SORT(___kcrctab_unused+*)) } 17 - __kcrctab_unused_gpl : { *(SORT(___kcrctab_unused_gpl+*)) } 18 - __kcrctab_gpl_future : { *(SORT(___kcrctab_gpl_future+*)) } 9 + __ksymtab 0 : { *(SORT(___ksymtab+*)) } 10 + __ksymtab_gpl 0 : { *(SORT(___ksymtab_gpl+*)) } 11 + __ksymtab_unused 0 : { *(SORT(___ksymtab_unused+*)) } 12 + __ksymtab_unused_gpl 0 : { *(SORT(___ksymtab_unused_gpl+*)) } 13 + __ksymtab_gpl_future 0 : { *(SORT(___ksymtab_gpl_future+*)) } 14 + __kcrctab 0 : { *(SORT(___kcrctab+*)) } 15 + __kcrctab_gpl 0 : { *(SORT(___kcrctab_gpl+*)) } 16 + __kcrctab_unused 0 : { *(SORT(___kcrctab_unused+*)) } 17 + __kcrctab_unused_gpl 0 : { *(SORT(___kcrctab_unused_gpl+*)) } 18 + __kcrctab_gpl_future 0 : { *(SORT(___kcrctab_gpl_future+*)) } 19 19 }