mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
tracing: Hold trace_types_lock when updating modules in persistent instances
trace_module_record() walks ftrace_trace_arrays from the module notifier
without trace_types_lock. A concurrent rmdir of an instance removes it
from the list and frees it under that lock, so a module load or unload
can walk into a freed trace_array.
Cc: stable@vger.kernel.org
Fixes: 5f3719f697 ("tracing: Update modules to persistent instances when loaded")
Link: https://patch.msgid.link/20261016061638.214847-1-devnexen@gmail.com
Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
parent
097fd00500
commit
66877a312a
|
|
@ -9244,6 +9244,8 @@ static void trace_module_record(struct module *mod, bool add)
|
|||
struct trace_array *tr;
|
||||
unsigned long flags;
|
||||
|
||||
guard(mutex)(&trace_types_lock);
|
||||
|
||||
list_for_each_entry(tr, &ftrace_trace_arrays, list) {
|
||||
flags = tr->flags & (TRACE_ARRAY_FL_BOOT | TRACE_ARRAY_FL_LAST_BOOT);
|
||||
/* Update any persistent trace array that has already been started */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user