summaryrefslogtreecommitdiff
path: root/tools/lib/python/kdoc/kdoc_re.py
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2025-12-02 16:17:51 -0500
committerSteven Rostedt (Google) <rostedt@goodmis.org>2025-12-05 15:17:56 -0500
commit02e7769e38c87c92b82db59923d3b0598d153903 (patch)
tree58bcd26a8960d3bfc0b2d906ecaf739c85a8f4d2 /tools/lib/python/kdoc/kdoc_re.py
parent2ba59045fba395c076a4880012583fdac25c6d7f (diff)
tracing: Fix enabling of tracing on file release
The trace file will pause tracing if the tracing instance has the "pause-on-trace" option is set. This happens when the file is opened, and it is unpaused when the file is closed. When this was first added, there was only one user that paused tracing. On open, the check to pause was: if (!iter->snapshot && (tr->trace_flags & TRACE_ITER(PAUSE_ON_TRACE))) Where if it is not the snapshot tracer and the "pause-on-trace" option is set, then it increments a "stop_count" of the trace instance. On close, the check is: if (!iter->snapshot && tr->stop_count) That is, if it is not the snapshot buffer and it was stopped, it will re-enable tracing. Now there's more places that stop tracing. This means, if something else stops tracing the tr->stop_count will be non-zero, and that means if the trace file is closed, it will decrement the stop_count even though it never incremented it. This causes a warning because when the user that stopped tracing enables it again, the stop_count goes below zero. Instead of relying on the stop_count being set to know if the close of the trace file should enable tracing again, add a new flag to the trace iterator. The trace iterator is unique per open of the trace file, and if the open stops tracing set the trace iterator PAUSE flag. On close, if the PAUSE flag is set, then re-enable it again. Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Link: https://patch.msgid.link/20251202161751.24abaaf1@gandalf.local.home Fixes: 06e0a548bad0f ("tracing: Do not disable tracing when reading the trace file") Reported-by: syzbot+ccdec3bfe0beec58a38d@syzkaller.appspotmail.com Closes: https://lore.kernel.org/all/692f44a5.a70a0220.2ea503.00c8.GAE@google.com/ Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Diffstat (limited to 'tools/lib/python/kdoc/kdoc_re.py')
0 files changed, 0 insertions, 0 deletions