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().
Showing the changes to kernel/livepatch (1 of 5 files). Show all
Unified · Split
| @@ -59,7 +59,7 @@ static void klp_find_object_module(struct klp_object *obj) · 58 unmodified lines | ||
| 59 | 59 | if (!klp_is_module(obj)) |
| 60 | 60 | return; |
| 61 | 61 | |
| 62 | − rcu_read_lock_sched(); | |
| 62 | + guard(rcu)(); | |
| 63 | 63 | /* |
| 64 | 64 | * We do not want to block removal of patched modules and therefore |
| 65 | 65 | * 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 | 76 | if (mod && mod->klp_alive) |
| 77 | 77 | obj->mod = mod; |
| 78 | − | |
| 79 | − rcu_read_unlock_sched(); | |
| 80 | 78 | } |
| 81 | 79 | |
| 82 | 80 | static bool klp_initialized(void) |