[for-linus][PATCH 0/5] tracing: Fixes for v7.4

From: Steven Rostedt

Date: Fri Nov 27 2026 - 13:43:06 EST



tracing fixes for v7.4:

- Fix user events on fork allocation failure

User events are created by user tasks to be able to be traced within
the kernel tracing facility. On fork, the duplication of user events
can fail. If this happens the state of the event becomes stale,
miss updates and produce undefined results.

As user events are part of the set up of the program that uses them,
fail a fork if the user event allocation fails for the new child.
This only affects programs that set up user events for themselves.

- Fix a remote event alignemnt offset output

The trace events for remote buffers does not take into account alignment
constraints, and produces incorrect field offsets that cause failure in
parsing the events from user space.

- Fix lost recursion records in recording ftrace functions that recurse

There's a race in the logic that records ftrace functions that recurse
where it checks if the last function that recursed is the same as the new
one and if it is, it ignores the recursion. But the recording of that last
function is done before the function is saved. If the saving fails due to
a race, then if the same function is recursed again, it will be ignored as
the code thinks it was recorded last time (but it wasn't).

- Reject '!!' at the beginning of input to set_ftrace_filter

To remove a single function from the set_ftrace_filter file, the user
echos "!func_name" into set_ftrace_filter and that function is removed
from the list. The issue is that the parsing logic sees the '!', records
it, removes it from the string and then continues the parsing with a "not"
variable set. The later logic of the "not" code checks if the first
character is a '!', and if it is, it triggers a WARN_ON() as it thinks the
logic was broken.

If the user echos in "!!func_name", the first '!' is removed and the not
variable set, and the second '!' is processed making the code think there
was a bug in the logic and triggers a WARN_ON().

Simply have the code first check for "!!" at the start and return -EINVAL
if that is found.

- Use atomic bitops and READ_ONCE() when processing flags variable

KSCAN reported a data race on the trace_event flags variable.
It is accessed in lockless mode during tracing and currently updated with
simple "|" or "&" logic. This causes a read-modify-write race.
Update the accesses to use bitops and READ_ONCE() to remove this race
condition.


git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/fixes

Head SHA1: 86020484c0cf36a72ab998274d051f9a14ff4f40


Andrea Parri (1):
ftrace: Fix lost recursion records in ftrace_record_recursion()

Jeff Barnes (1):
tracing/user_events: Fail fork when event state duplication fails

Masami Hiramatsu (Google) (1):
tracing/filters: Use atomic bitops and READ_ONCE() for trace_event_file::flags

Vincent Donnefort (1):
tracing/remotes: Align field offset in remote_event_format_show()

Yifan Feng (1):
ftrace: Reject "!!" in front of a set_ftrace_filter command

----
include/linux/trace_events.h | 2 +-
include/linux/user_events.h | 16 +++++++---------
kernel/fork.c | 8 ++++++--
kernel/trace/ftrace.c | 7 +++++++
kernel/trace/trace.c | 7 ++++---
kernel/trace/trace.h | 18 ++++++++++--------
kernel/trace/trace_events.c | 2 +-
kernel/trace/trace_events_filter.c | 12 ++----------
kernel/trace/trace_events_trigger.c | 5 +++--
kernel/trace/trace_events_user.c | 8 +++++---
kernel/trace/trace_recursion_record.c | 17 +++++++++--------
kernel/trace/trace_remote.c | 1 +
12 files changed, 56 insertions(+), 47 deletions(-)