From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>, linux-trace-kernel@vger.kernel.org
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Tom Zanussi <tom.zanussi@linux.intel.com>,
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>,
Donggeun Yoo <donggeunyoo.kernel@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 0/3] tracing: Roll back event flags and soft/trigger-mode refs on register failure
Date: Sun, 06 Dec 2026 21:22:15 +0900 [thread overview]
Message-ID: <20261206115150.61594-1-mhiramat@kernel.org> (raw)
Hi,
This 3-patch series fixes flag and reference-count leaks in the event
enable and trigger registration error paths when
call->class->reg(call, TRACE_REG_REGISTER, file) fails (for example
with -ENOMEM, -EBUSY, -ENOENT, or -ENOSPC).
Without these fixes, a failed soft-mode or trigger registration leaves
file->sm_ref, file->tm_ref, trace_buffered_event_ref, and event file
flags leaked, allowing a subsequent trigger registration to bypass
TRACE_REG_REGISTER via the refcount fast path and causing a
use-after-free on trace_event_file when the trace instance is later
removed.
The series is split into three bisect-safe patches for clean stable
backports:
- [1/3] Clear EVENT_FILE_FL_RECORDED_CMD_BIT and
EVENT_FILE_FL_RECORDED_TGID_BIT when TRACE_REG_REGISTER fails in
__ftrace_event_enable_disable() (also affects non-soft-mode enables).
- [2/3] Check the return value of trace_event_trigger_enable_disable()
in enable_eprobe() and roll back the eprobe trigger on failure.
- [3/3] Roll back soft-mode and trigger-mode refcounts/flags on
register failure in __ftrace_event_enable_disable() and
trace_event_trigger_enable_disable(), atomically updating
hist_trigger_enable() / event_hist_trigger_parse() so they do not
double-decrement tm_ref (since commit 92383cef6679 previously relied
on hist_unregister_trigger() to pair the leaked refs).
This series is based on linux-trace/trace/fixes (a6a40ab36abb).
Thank you,
Masami Hiramatsu (Google) (3):
tracing: Clear RECORDED_CMD and RECORDED_TGID flags on register
failure
tracing/eprobe: Handle trace_event_trigger_enable_disable() failure in
enable_eprobe()
tracing: Roll back soft-mode and trigger-mode refs on register failure
kernel/trace/trace_eprobe.c | 14 +++++++++++++-
kernel/trace/trace_events.c | 16 ++++++++++++++--
kernel/trace/trace_events_hist.c | 28 +++++++++++++++-------------
kernel/trace/trace_events_trigger.c | 4 ++++
4 files changed, 46 insertions(+), 16 deletions(-)
base-commit: a6a40ab36abb91e698b08cc7a0d3dc9455fcfaf4
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next reply other threads:[~2026-12-06 12:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-06 12:22 Masami Hiramatsu (Google) [this message]
2026-12-06 12:22 ` [PATCH 1/3] tracing: Clear RECORDED_CMD and RECORDED_TGID flags on register failure Masami Hiramatsu (Google)
2026-12-06 12:22 ` [PATCH 2/3] tracing/eprobe: Handle trace_event_trigger_enable_disable() failure in enable_eprobe() Masami Hiramatsu (Google)
2026-12-06 12:40 ` sashiko-bot
2026-12-06 12:22 ` [PATCH 3/3] tracing: Roll back soft-mode and trigger-mode refs on register failure Masami Hiramatsu (Google)
2026-12-06 12:40 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261206115150.61594-1-mhiramat@kernel.org \
--to=mhiramat@kernel.org \
--cc=donggeunyoo.kernel@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=rostedt@goodmis.org \
--cc=tom.zanussi@linux.intel.com \
--cc=tz.stoyanov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox