Skip to content

Commit 17a9992

Browse files
Sebastian Andrzej Siewiorpetrpavlu
authored andcommitted
arm64: module: Use RCU in all users of __module_text_address().
__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: Catalin Marinas <catalin.marinas@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Will Deacon <will@kernel.org> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-trace-kernel@vger.kernel.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-18-bigeasy@linutronix.de Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
1 parent 59aa141 commit 17a9992

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

arch/arm64/kernel/ftrace.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,13 @@ static bool ftrace_find_callable_addr(struct dyn_ftrace *rec,
320320
* dealing with an out-of-range condition, we can assume it
321321
* is due to a module being loaded far away from the kernel.
322322
*
323-
* NOTE: __module_text_address() must be called with preemption
324-
* disabled, but we can rely on ftrace_lock to ensure that 'mod'
323+
* NOTE: __module_text_address() must be called within a RCU read
324+
* section, but we can rely on ftrace_lock to ensure that 'mod'
325325
* retains its validity throughout the remainder of this code.
326326
*/
327327
if (!mod) {
328-
preempt_disable();
328+
guard(rcu)();
329329
mod = __module_text_address(pc);
330-
preempt_enable();
331330
}
332331

333332
if (WARN_ON(!mod))

0 commit comments

Comments
 (0)