]> www.infradead.org Git - users/hch/misc.git/commitdiff
jump_label: Use RCU in all users of __module_text_address().
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 8 Jan 2025 09:04:53 +0000 (10:04 +0100)
committerPetr Pavlu <petr.pavlu@suse.com>
Mon, 10 Mar 2025 10:54:46 +0000 (11:54 +0100)
__module_text_address() can be invoked within a RCU section, there is no
requirement to have preemption disabled.

Replace the preempt_disable() section around __module_text_address()
with RCU.

Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Jason Baron <jbaron@akamai.com>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
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-25-bigeasy@linutronix.de
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
kernel/jump_label.c

index 7fcf4017cb3838f389dbf14ab426c48056b8d35c..7cb19e6014266adb2d38d49ad0806766895c58b0 100644 (file)
@@ -653,13 +653,12 @@ static int __jump_label_mod_text_reserved(void *start, void *end)
        struct module *mod;
        int ret;
 
-       preempt_disable();
-       mod = __module_text_address((unsigned long)start);
-       WARN_ON_ONCE(__module_text_address((unsigned long)end) != mod);
-       if (!try_module_get(mod))
-               mod = NULL;
-       preempt_enable();
-
+       scoped_guard(rcu) {
+               mod = __module_text_address((unsigned long)start);
+               WARN_ON_ONCE(__module_text_address((unsigned long)end) != mod);
+               if (!try_module_get(mod))
+                       mod = NULL;
+       }
        if (!mod)
                return 0;