Commit 673af170ceca for kernel
commit 673af170ceca345ce010aeeb1818172844f6b8c9
Merge: f4585067150b 76a0a6d58318
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Fri Nov 27 18:08:31 2026 -0800
Merge tag 'trace-v7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull tracing fixes from Steven Rostedt:
- 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.
- Fix accounting of getting reader page of remote buffer
The rb_check_pages() is an optional debug feature to validate the
ring buffer pages. The reader can swap the head page of the walk of
pages where it never finds the beginning and will loop forever. When
the reader swaps the page it updates a cnt variable that is used in
the rb_check_pages() which will cause it to exit out of the loop if
it sees that it changes.
The remote updates did not increment this counter and if debugging
and buffer page validation is enabled it can cause it to go into an
infinite loop.
* tag 'trace-v7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
ring-buffer: Add missing cnt increment for remote ring buffers
tracing/filters: Use atomic bitops and READ_ONCE() for trace_event_file::flags
ftrace: Reject "!!" in front of a set_ftrace_filter command
ftrace: Fix lost recursion records in ftrace_record_recursion()
tracing/remotes: Align field offset in remote_event_format_show()
tracing/user_events: Fail fork when event state duplication fails