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(). Cc: Jiri Kosina <jikos@kernel.org> Cc: Joe Lawrence <joe.lawrence@redhat.com> Cc: Josh Poimboeuf <jpoimboe@kernel.org> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Miroslav Benes <mbenes@suse.cz> Cc: Petr Mladek <pmladek@suse.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: linux-trace-kernel@vger.kernel.org Cc: live-patching@vger.kernel.org Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20250108090457.512198-7-bigeasy@linutronix.de Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
This commit is contained in:
committed by
Petr Pavlu
parent
c4fadf38de
commit
febaa65c94
@@ -124,9 +124,8 @@ static nokprobe_inline bool trace_kprobe_module_exist(struct trace_kprobe *tk)
|
||||
if (!p)
|
||||
return true;
|
||||
*p = '\0';
|
||||
rcu_read_lock_sched();
|
||||
ret = !!find_module(tk->symbol);
|
||||
rcu_read_unlock_sched();
|
||||
scoped_guard(rcu)
|
||||
ret = !!find_module(tk->symbol);
|
||||
*p = ':';
|
||||
|
||||
return ret;
|
||||
@@ -796,12 +795,10 @@ static struct module *try_module_get_by_name(const char *name)
|
||||
{
|
||||
struct module *mod;
|
||||
|
||||
rcu_read_lock_sched();
|
||||
guard(rcu)();
|
||||
mod = find_module(name);
|
||||
if (mod && !try_module_get(mod))
|
||||
mod = NULL;
|
||||
rcu_read_unlock_sched();
|
||||
|
||||
return mod;
|
||||
}
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user