From: Lee Jones <lee@kernel.org>
To: lee@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Steven Rostedt <rostedt@goodmis.org>,
Tom Zanussi <tom.zanussi@linux.intel.com>
Subject: [PATCH 0/2] tracing: Harden synthetic event string validation and copying
Date: Tue, 1 Dec 2026 14:29:05 +0000 [thread overview]
Message-ID: <20261201142918.1849179-1-lee@kernel.org> (raw)
These two follow-up patches harden synthetic event string handling on
top of the pending read-fault fix ("tracing/synthetic: Handle dynamic
string read faults"):
1. Reject non-string histogram fields (scalars, constants, and raw
FILTER_PTR_STRING pointers) when matching synthetic string fields
in check_synth_field(), mirroring the stacktrace validation fix in
commit a244c241593b ("tracing/histograms: Reject non-stacktrace
fields for synthetic stacktrace fields"). Note that syscall
FILTER_PTR_STRING fields (such as sys_enter_openat's filename) are
intentionally rejected here because user-controlled pointers can
carry arbitrary kernel addresses into fetch_store_string(); passing
them as u64 and reading them with a :ustring eprobe remains
unaffected.
2. Eliminate the TOCTOU ring-buffer and perf-buffer overflow in
trace_string() (reported by Sashiko) by measuring each dynamic
string once during the sizing pass and bounding fetch_store_string()
to the per-field reserved length.
Patch 1 applies independently to trace/for-next; patch 2 is based on
"[RESEND] tracing/synthetic: Handle dynamic string read faults".
Cc: linux-trace-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
Lee Jones (2):
tracing/histograms: Reject non-string fields for synthetic string
fields
tracing/synthetic: Bound dynamic string copy to reserved length
kernel/trace/trace_events_hist.c | 11 ++++--
kernel/trace/trace_events_synth.c | 66 +++++++++++++++++++++----------
2 files changed, 53 insertions(+), 24 deletions(-)
--
2.56.1.839.g22a8290db9-goog
next reply other threads:[~2026-12-01 14:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 14:29 Lee Jones [this message]
2026-12-01 14:29 ` [PATCH 1/2] tracing/histograms: Reject non-string fields for synthetic string fields Lee Jones
2026-12-01 14:29 ` [PATCH 2/2] tracing/synthetic: Bound dynamic string copy to reserved length Lee Jones
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=20261201142918.1849179-1-lee@kernel.org \
--to=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=tom.zanussi@linux.intel.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