delete_module() first sets the module's state to MODULE_STATE_GOING which means further try_module_get() invocations will fail. However without a RCU readlock there is nothing that ensures that the pointer returned by __module_text_address() is still valid in try_module_get(). The preempt_disable() does not protect here against module removal from another CPU.
Signed-off-by: Sebastian Andrzej Siewior <bige...@linutronix.de> --- kernel/kprobes.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index c90e417bb963..a2d4e5164d7d 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -1449,6 +1449,7 @@ static int check_kprobe_address_safe(struct kprobe *p, } /* Check if are we probing a module */ + rcu_read_lock(); *probed_mod = __module_text_address((unsigned long) p->addr); if (*probed_mod) { /* @@ -1457,7 +1458,7 @@ static int check_kprobe_address_safe(struct kprobe *p, */ if (unlikely(!try_module_get(*probed_mod))) { ret = -ENOENT; - goto out; + goto out_rcu_unlock; } /* @@ -1471,6 +1472,8 @@ static int check_kprobe_address_safe(struct kprobe *p, ret = -ENOENT; } } +out_rcu_unlock: + rcu_read_unlock(); out: preempt_enable(); jump_label_unlock(); -- 2.4.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/