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
5959 if (!klp_is_module(obj))
6060 return;
6161
62− rcu_read_lock_sched();
62+ guard(rcu)();
6363 /*
6464 * We do not want to block removal of patched modules and therefore
6565 * 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
7575 */
7676 if (mod && mod->klp_alive)
7777 obj->mod = mod;
78−
79− rcu_read_unlock_sched();
8078 }
8179
8280 static bool klp_initialized(void)