History

module: Use RCU in find_module_all().

The modules list and module::kallsyms can be accessed under RCU assumption. Remove module_assert_mutex_or_preempt() from find_module_all() so it can be used under RCU protection without warnings. Update its callers to use RCU protection instead of preempt_disable().

Sebastian Andrzej Siewior committed 1 year ago

Commit febaa651 parent c4fadf35 files · +8 −14Browse files

Showing the changes to kernel/livepatch (1 of 5 files). Show all

Unified · Split

kernel/livepatch/core.c+1−3
@@ -59,7 +59,7 @@ static void klp_find_object_module(struct klp_object *obj) · 58 unmodified lines
59 if (!klp_is_module(obj))59 if (!klp_is_module(obj))
60 return;60 return;
61 61
62 rcu_read_lock_sched();62 guard(rcu)();
63 /*63 /*
64 * We do not want to block removal of patched modules and therefore64 * We do not want to block removal of patched modules and therefore
65 * we do not take a reference here. The patches are removed by65 * we do not take a reference here. The patches are removed by
@@ -75,8 +75,6 @@ static void klp_find_object_module(struct klp_object *obj) · 9 unmodified lines
75 */75 */
76 if (mod && mod->klp_alive)76 if (mod && mod->klp_alive)
77 obj->mod = mod;77 obj->mod = mod;
78
79 rcu_read_unlock_sched();
80}78}
81 79
82static bool klp_initialized(void)80static bool klp_initialized(void)