The `modules' list uses list_for_each_entry_rcu() itarator. rcu_readlock() protects here against against module removal invoked from another CPU while preempt_disable() does not.
I don't understand what syncs in CONFIG_MODULES_TREE_LOOKUP against module removal. In the other (RCU) case there is synchronize_sched(). Signed-off-by: Sebastian Andrzej Siewior <[email protected]> --- kernel/module.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index 4d2b82e610e2..a62d2d48cd63 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -3979,9 +3979,9 @@ bool is_module_address(unsigned long addr) { bool ret; - preempt_disable(); + rcu_read_lock(); ret = __module_address(addr) != NULL; - preempt_enable(); + rcu_read_unlock(); return ret; } @@ -3990,7 +3990,7 @@ bool is_module_address(unsigned long addr) * __module_address - get the module which contains an address. * @addr: the address. * - * Must be called with preempt disabled or module mutex held so that + * Must be called with RCU read or module mutex held so that * module doesn't get freed during this. */ struct module *__module_address(unsigned long addr) @@ -4024,9 +4024,9 @@ bool is_module_text_address(unsigned long addr) { bool ret; - preempt_disable(); + rcu_read_lock(); ret = __module_text_address(addr) != NULL; - preempt_enable(); + rcu_read_unlock(); return ret; } @@ -4035,7 +4035,7 @@ bool is_module_text_address(unsigned long addr) * __module_text_address - get the module whose code contains an address. * @addr: the address. * - * Must be called with preempt disabled or module mutex held so that + * Must be called with RCU read lock or module mutex held so that * module doesn't get freed during this. */ struct module *__module_text_address(unsigned long addr) -- 2.4.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

