|
67 | 67 |
|
68 | 68 | /*
|
69 | 69 | * Mutex protects:
|
70 |
| - * 1) List of modules (also safely readable with preempt_disable), |
| 70 | + * 1) List of modules (also safely readable within RCU read section), |
71 | 71 | * 2) module_use links,
|
72 | 72 | * 3) mod_tree.addr_min/mod_tree.addr_max.
|
73 | 73 | * (delete and add uses RCU list operations).
|
@@ -1348,7 +1348,7 @@ static void free_module(struct module *mod)
|
1348 | 1348 | mod_tree_remove(mod);
|
1349 | 1349 | /* Remove this module from bug list, this uses list_del_rcu */
|
1350 | 1350 | module_bug_cleanup(mod);
|
1351 |
| - /* Wait for RCU-sched synchronizing before releasing mod->list and buglist. */ |
| 1351 | + /* Wait for RCU synchronizing before releasing mod->list and buglist. */ |
1352 | 1352 | synchronize_rcu();
|
1353 | 1353 | if (try_add_tainted_module(mod))
|
1354 | 1354 | pr_err("%s: adding tainted module to the unloaded tainted modules list failed.\n",
|
@@ -3049,7 +3049,7 @@ static noinline int do_init_module(struct module *mod)
|
3049 | 3049 | #endif
|
3050 | 3050 | /*
|
3051 | 3051 | * We want to free module_init, but be aware that kallsyms may be
|
3052 |
| - * walking this with preempt disabled. In all the failure paths, we |
| 3052 | + * walking this within an RCU read section. In all the failure paths, we |
3053 | 3053 | * call synchronize_rcu(), but we don't want to slow down the success
|
3054 | 3054 | * path. execmem_free() cannot be called in an interrupt, so do the
|
3055 | 3055 | * work and call synchronize_rcu() in a work queue.
|
@@ -3836,15 +3836,14 @@ void print_modules(void)
|
3836 | 3836 |
|
3837 | 3837 | printk(KERN_DEFAULT "Modules linked in:");
|
3838 | 3838 | /* Most callers should already have preempt disabled, but make sure */
|
3839 |
| - preempt_disable(); |
| 3839 | + guard(rcu)(); |
3840 | 3840 | list_for_each_entry_rcu(mod, &modules, list) {
|
3841 | 3841 | if (mod->state == MODULE_STATE_UNFORMED)
|
3842 | 3842 | continue;
|
3843 | 3843 | pr_cont(" %s%s", mod->name, module_flags(mod, buf, true));
|
3844 | 3844 | }
|
3845 | 3845 |
|
3846 | 3846 | print_unloaded_tainted_modules();
|
3847 |
| - preempt_enable(); |
3848 | 3847 | if (last_unloaded_module.name[0])
|
3849 | 3848 | pr_cont(" [last unloaded: %s%s]", last_unloaded_module.name,
|
3850 | 3849 | last_unloaded_module.taints);
|
|
0 commit comments