mirror of https://github.com/torvalds/linux.git
module: Use RCU in all users of __module_address().
__module_address() can be invoked within a RCU section, there is no requirement to have preemption disabled. Replace the preempt_disable() section around __module_address() with RCU. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20250108090457.512198-15-bigeasy@linutronix.de Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
This commit is contained in:
parent
2abf84f688
commit
6593a2c990
|
|
@ -55,12 +55,11 @@ static inline void *dereference_symbol_descriptor(void *ptr)
|
||||||
if (is_ksym_addr((unsigned long)ptr))
|
if (is_ksym_addr((unsigned long)ptr))
|
||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
preempt_disable();
|
guard(rcu)();
|
||||||
mod = __module_address((unsigned long)ptr);
|
mod = __module_address((unsigned long)ptr);
|
||||||
|
|
||||||
if (mod)
|
if (mod)
|
||||||
ptr = dereference_module_function_descriptor(mod, ptr);
|
ptr = dereference_module_function_descriptor(mod, ptr);
|
||||||
preempt_enable();
|
|
||||||
#endif
|
#endif
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -316,7 +316,7 @@ void * __weak dereference_module_function_descriptor(struct module *mod,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For kallsyms to ask for address resolution. NULL means not found. Careful
|
* For kallsyms to ask for address resolution. NULL means not found. Careful
|
||||||
* not to lock to avoid deadlock on oopses, simply disable preemption.
|
* not to lock to avoid deadlock on oopses, RCU is enough.
|
||||||
*/
|
*/
|
||||||
int module_address_lookup(unsigned long addr,
|
int module_address_lookup(unsigned long addr,
|
||||||
unsigned long *size,
|
unsigned long *size,
|
||||||
|
|
@ -330,7 +330,6 @@ int module_address_lookup(unsigned long addr,
|
||||||
struct module *mod;
|
struct module *mod;
|
||||||
|
|
||||||
guard(rcu)();
|
guard(rcu)();
|
||||||
preempt_disable();
|
|
||||||
mod = __module_address(addr);
|
mod = __module_address(addr);
|
||||||
if (mod) {
|
if (mod) {
|
||||||
if (modname)
|
if (modname)
|
||||||
|
|
@ -348,8 +347,6 @@ int module_address_lookup(unsigned long addr,
|
||||||
if (sym)
|
if (sym)
|
||||||
ret = strscpy(namebuf, sym, KSYM_NAME_LEN);
|
ret = strscpy(namebuf, sym, KSYM_NAME_LEN);
|
||||||
}
|
}
|
||||||
preempt_enable();
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3731,13 +3731,8 @@ const struct exception_table_entry *search_module_extables(unsigned long addr)
|
||||||
*/
|
*/
|
||||||
bool is_module_address(unsigned long addr)
|
bool is_module_address(unsigned long addr)
|
||||||
{
|
{
|
||||||
bool ret;
|
guard(rcu)();
|
||||||
|
return __module_address(addr) != NULL;
|
||||||
preempt_disable();
|
|
||||||
ret = __module_address(addr) != NULL;
|
|
||||||
preempt_enable();
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue