[PATCH 0/2] tracing: Harden synthetic event string validation and copying
From: Lee Jones
Date: Tue Dec 01 2026 - 09:29:36 EST
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@xxxxxxxxxxxxxxx
Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
Cc: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Tom Zanussi <tom.zanussi@xxxxxxxxxxxxxxx>
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