* [GIT PULL] tracing: Fixes for v7.4
@ 2026-11-27 22:29 Steven Rostedt
0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2026-11-27 22:29 UTC (permalink / raw)
To: Linus Torvalds
Cc: LKML, Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton,
Andrea Parri, Jeff Barnes, Vincent Donnefort, Yifan Feng
Linus,
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 alignment 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.
Please pull the latest trace-v7.4-rc4 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace-v7.4-rc4
Tag SHA1: 8266237b33642737f753c22196b5a0a7741eb7be
Head SHA1: 76a0a6d58318fff8b14530ed9b99c7065995db29
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 (2):
tracing/remotes: Align field offset in remote_event_format_show()
ring-buffer: Add missing cnt increment for remote ring buffers
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/ring_buffer.c | 1 +
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 +
13 files changed, 57 insertions(+), 47 deletions(-)
---------------------------
diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h
index 321f2f3a6c8e..7a0aa23825de 100644
--- a/include/linux/trace_events.h
+++ b/include/linux/trace_events.h
@@ -764,7 +764,7 @@ bool __trace_trigger_soft_disabled(struct trace_event_file *file);
static __always_inline bool
trace_trigger_soft_disabled(struct trace_event_file *file)
{
- unsigned long eflags = file->flags;
+ unsigned long eflags = READ_ONCE(file->flags);
if (likely(!(eflags & (EVENT_FILE_FL_TRIGGER_MODE |
EVENT_FILE_FL_SOFT_DISABLED |
diff --git a/include/linux/user_events.h b/include/linux/user_events.h
index 57d1ff006090..75f184126727 100644
--- a/include/linux/user_events.h
+++ b/include/linux/user_events.h
@@ -27,28 +27,26 @@ struct user_event_mm {
struct rcu_work put_rwork;
};
-extern void user_event_mm_dup(struct task_struct *t,
- struct user_event_mm *old_mm);
+int user_event_mm_dup(struct task_struct *t, struct user_event_mm *old_mm);
extern void user_event_mm_remove(struct task_struct *t);
-static inline void user_events_fork(struct task_struct *t,
- u64 clone_flags)
+static inline int user_events_fork(struct task_struct *t, u64 clone_flags)
{
struct user_event_mm *old_mm;
if (!t || !current->user_event_mm)
- return;
+ return 0;
old_mm = current->user_event_mm;
if (clone_flags & CLONE_VM) {
t->user_event_mm = old_mm;
refcount_inc(&old_mm->tasks);
- return;
+ return 0;
}
- user_event_mm_dup(t, old_mm);
+ return user_event_mm_dup(t, old_mm);
}
static inline void user_events_execve(struct task_struct *t)
@@ -67,9 +65,9 @@ static inline void user_events_exit(struct task_struct *t)
user_event_mm_remove(t);
}
#else
-static inline void user_events_fork(struct task_struct *t,
- u64 clone_flags)
+static inline int user_events_fork(struct task_struct *t, u64 clone_flags)
{
+ return 0;
}
static inline void user_events_execve(struct task_struct *t)
diff --git a/kernel/fork.c b/kernel/fork.c
index 5efceb8d58a7..cdba6ba6335d 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -2328,9 +2328,12 @@ __latent_entropy struct task_struct *copy_process(
retval = copy_mm(clone_flags, p);
if (retval)
goto bad_fork_cleanup_signal;
- retval = copy_namespaces(clone_flags, p);
+ retval = user_events_fork(p, clone_flags);
if (retval)
goto bad_fork_cleanup_mm;
+ retval = copy_namespaces(clone_flags, p);
+ if (retval)
+ goto bad_fork_cleanup_user_events;
retval = copy_io(clone_flags, p);
if (retval)
goto bad_fork_cleanup_namespaces;
@@ -2598,7 +2601,6 @@ __latent_entropy struct task_struct *copy_process(
trace_task_newtask(p, clone_flags);
uprobe_copy_process(p, clone_flags);
- user_events_fork(p, clone_flags);
copy_oom_score_adj(clone_flags, p);
@@ -2625,6 +2627,8 @@ __latent_entropy struct task_struct *copy_process(
exit_io_context(p);
bad_fork_cleanup_namespaces:
exit_nsproxy_namespaces(p);
+bad_fork_cleanup_user_events:
+ user_events_exit(p);
bad_fork_cleanup_mm:
sched_cache_fork_cleanup(p);
if (p->mm) {
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 6654da9d1bbf..5b161959e701 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -5847,6 +5847,13 @@ static int ftrace_process_regex(struct ftrace_iterator *iter,
/* command found */
+ /*
+ * A double "!!" confuses the parser. This isn't a boolean operation,
+ * simply reject it.
+ */
+ if (func[0] == '!' && func[1] == '!')
+ return -EINVAL;
+
command = strsep(&next, ":");
guard(mutex)(&ftrace_cmd_mutex);
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index a5a0adc934fa..65dddfac5e04 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -5891,6 +5891,7 @@ __rb_get_reader_page_from_remote(struct ring_buffer_per_cpu *cpu_buffer)
cpu_buffer->pages = &new_head->list;
cpu_buffer->lost_events = cpu_buffer->meta_page->reader.lost_events;
local_inc(&cpu_buffer->pages_read);
+ cpu_buffer->cnt++;
if (!rb_page_size(cpu_buffer->reader_page))
return NULL;
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 65b9d67647e5..fa65ef8d7fbe 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1886,7 +1886,8 @@ trace_event_buffer_lock_reserve(struct trace_buffer **current_rb,
*current_rb = tr->array_buffer.buffer;
if (!tr->no_filter_buffering_ref &&
- (trace_file->flags & (EVENT_FILE_FL_SOFT_DISABLED | EVENT_FILE_FL_FILTERED))) {
+ (READ_ONCE(trace_file->flags) &
+ (EVENT_FILE_FL_SOFT_DISABLED | EVENT_FILE_FL_FILTERED))) {
preempt_disable_notrace();
/*
* Filtering is on, so try to use the per cpu buffer first.
@@ -1947,7 +1948,7 @@ trace_event_buffer_lock_reserve(struct trace_buffer **current_rb,
* to store the trace event for the trigger to use. It's recursive
* safe and will not be recorded anywhere.
*/
- if (!entry && trace_file->flags & EVENT_FILE_FL_TRIGGER_COND) {
+ if (!entry && (READ_ONCE(trace_file->flags) & EVENT_FILE_FL_TRIGGER_COND)) {
*current_rb = temp_buffer;
entry = __trace_buffer_lock_reserve(*current_rb, type, len,
trace_ctx);
@@ -1978,7 +1979,7 @@ static void output_printk(struct trace_event_buffer *fbuffer)
file = fbuffer->trace_file;
if (test_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags) ||
- (unlikely(file->flags & EVENT_FILE_FL_FILTERED) &&
+ (unlikely(test_bit(EVENT_FILE_FL_FILTERED_BIT, &file->flags)) &&
!filter_match_preds(file->filter, fbuffer->entry)))
return;
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 1fec567e789e..32997b58a8a0 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -1729,24 +1729,26 @@ __event_trigger_test_discard(struct trace_event_file *file,
void *entry,
enum event_trigger_type *tt)
{
- unsigned long eflags = file->flags;
+ unsigned long eflags = READ_ONCE(file->flags);
- if (eflags & EVENT_FILE_FL_TRIGGER_COND)
+ if (eflags & EVENT_FILE_FL_TRIGGER_COND) {
*tt = event_triggers_call(file, buffer, entry, event);
+ eflags = READ_ONCE(file->flags);
+ }
- if (likely(!(file->flags & (EVENT_FILE_FL_SOFT_DISABLED |
- EVENT_FILE_FL_FILTERED |
- EVENT_FILE_FL_PID_FILTER))))
+ if (likely(!(eflags & (EVENT_FILE_FL_SOFT_DISABLED |
+ EVENT_FILE_FL_FILTERED |
+ EVENT_FILE_FL_PID_FILTER))))
return false;
- if (file->flags & EVENT_FILE_FL_SOFT_DISABLED)
+ if (eflags & EVENT_FILE_FL_SOFT_DISABLED)
goto discard;
- if (file->flags & EVENT_FILE_FL_FILTERED &&
+ if (eflags & EVENT_FILE_FL_FILTERED &&
!filter_match_preds(file->filter, entry))
goto discard;
- if ((file->flags & EVENT_FILE_FL_PID_FILTER) &&
+ if ((eflags & EVENT_FILE_FL_PID_FILTER) &&
trace_event_ignore_this_pid(file))
goto discard;
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 7f89160aeff3..394d7cde1a70 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -707,7 +707,7 @@ void *trace_event_buffer_reserve(struct trace_event_buffer *fbuffer,
{
struct trace_event_call *event_call = trace_file->event_call;
- if ((trace_file->flags & EVENT_FILE_FL_PID_FILTER) &&
+ if (test_bit(EVENT_FILE_FL_PID_FILTER_BIT, &trace_file->flags) &&
trace_event_ignore_this_pid(trace_file))
return NULL;
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index a9d77df3e19a..b3ac2519a62d 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -1349,11 +1349,7 @@ static void free_prog(struct event_filter *filter)
static void filter_disable(struct trace_event_file *file)
{
- unsigned long old_flags = file->flags;
-
- file->flags &= ~EVENT_FILE_FL_FILTERED;
-
- if (old_flags != file->flags)
+ if (test_and_clear_bit(EVENT_FILE_FL_FILTERED_BIT, &file->flags))
trace_buffered_event_disable();
}
@@ -2331,11 +2327,7 @@ static int process_preds(struct trace_event_call *call,
static inline void event_set_filtered_flag(struct trace_event_file *file)
{
- unsigned long old_flags = file->flags;
-
- file->flags |= EVENT_FILE_FL_FILTERED;
-
- if (old_flags != file->flags)
+ if (!test_and_set_bit(EVENT_FILE_FL_FILTERED_BIT, &file->flags))
trace_buffered_event_enable();
}
diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
index a2487ad7fef8..96203ba72ab9 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -214,7 +214,7 @@ EXPORT_SYMBOL_GPL(event_triggers_call);
bool __trace_trigger_soft_disabled(struct trace_event_file *file)
{
- unsigned long eflags = file->flags;
+ unsigned long eflags = READ_ONCE(file->flags);
if (eflags & EVENT_FILE_FL_TRIGGER_MODE)
event_triggers_call(file, NULL, NULL, NULL);
@@ -1692,7 +1692,8 @@ event_enable_count_func(struct event_trigger_data *data,
return false;
/* Skip if the event is in a state we want to switch to */
- if (enable_data->enable == !(enable_data->file->flags & EVENT_FILE_FL_SOFT_DISABLED))
+ if (enable_data->enable == !test_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT,
+ &enable_data->file->flags))
return false;
if (data->count != -1)
diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index e29e1c772aa7..c561443f7947 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -868,7 +868,7 @@ void user_event_mm_remove(struct task_struct *t)
queue_rcu_work(system_percpu_wq, &mm->put_rwork);
}
-void user_event_mm_dup(struct task_struct *t, struct user_event_mm *old_mm)
+int user_event_mm_dup(struct task_struct *t, struct user_event_mm *old_mm)
{
struct user_event_mm *mm = user_event_mm_alloc(t);
struct user_event_enabler *enabler;
@@ -877,7 +877,7 @@ void user_event_mm_dup(struct task_struct *t, struct user_event_mm *old_mm)
t->user_event_mm = NULL;
if (!mm)
- return;
+ return -ENOMEM;
rcu_read_lock();
@@ -889,10 +889,12 @@ void user_event_mm_dup(struct task_struct *t, struct user_event_mm *old_mm)
rcu_read_unlock();
user_event_mm_attach(mm, t);
- return;
+ return 0;
error:
rcu_read_unlock();
user_event_mm_destroy(mm);
+
+ return -ENOMEM;
}
static bool current_user_event_enabler_exists(unsigned long uaddr,
diff --git a/kernel/trace/trace_recursion_record.c b/kernel/trace/trace_recursion_record.c
index bac4bc844ccd..4f63bec052fc 100644
--- a/kernel/trace/trace_recursion_record.c
+++ b/kernel/trace/trace_recursion_record.c
@@ -17,8 +17,8 @@ static struct recursed_functions recursed_functions[CONFIG_FTRACE_RECORD_RECURSI
static atomic_t nr_records;
/*
- * Cache the last found function. Yes, updates to this is racey, but
- * so is memory cache ;-)
+ * Cache the last function found in or added to recursed_functions[].
+ * Updates to this are racy, but this is only a best-effort cache.
*/
static unsigned long cached_function;
@@ -67,24 +67,25 @@ void ftrace_record_recursion(unsigned long ip, unsigned long parent_ip)
}
}
- cached_function = ip;
-
/*
* We only want to add a function if it hasn't been added before.
- * Add to the current location before incrementing the count.
- * If it fails to add, then increment the index (save in i)
- * and try again.
+ * Claim the current slot before incrementing the count. If the slot
+ * is occupied by another function, advance to the next slot and retry.
+ *
+ * Do not update cached_function until ip is known to be present;
+ * otherwise the retry would match its own cache update.
*/
old = cmpxchg(&recursed_functions[index].ip, 0, ip);
if (old != 0) {
/* Did something else already added this for us? */
if (old == ip)
return;
- /* Try the next location (use i for the next index) */
+ /* Try the next location */
index++;
goto again;
}
+ cached_function = ip;
recursed_functions[index].parent_ip = parent_ip;
/*
diff --git a/kernel/trace/trace_remote.c b/kernel/trace/trace_remote.c
index 2d5bc423efca..7e35f48ae467 100644
--- a/kernel/trace/trace_remote.c
+++ b/kernel/trace/trace_remote.c
@@ -1098,6 +1098,7 @@ static int remote_event_format_show(struct seq_file *s, void *unused)
field = &evt->fields[0];
while (field->name) {
+ offset = ALIGN(offset, field->align);
seq_printf(s, "\tfield:%s %s;\toffset:%zu;\tsize:%u;\tsigned:%d;\n",
field->type, field->name, offset, field->size,
field->is_signed);
^ permalink raw reply [flat|nested] 3+ messages in thread* [GIT PULL] tracing: Fixes for v7.4
@ 2026-11-21 12:57 Steven Rostedt
2026-11-21 23:24 ` pr-tracker-bot
0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2026-11-21 12:57 UTC (permalink / raw)
To: Linus Torvalds
Cc: LKML, Masami Hiramatsu, Mathieu Desnoyers, Amit Machhiwal,
Baek Kyu, Kim, Breno Leitao, Brian Norris, Chaosheng Qu,
Christian Aurich Zanettini Martins, David Carlier, Jaewon Jung,
Kyle Zeng, Pengfei Li, Vincent Donnefort, Vineet Gupta,
Wenwu Hou
Linus,
tracing fixes for v7.4:
- Do not WARN when trace_rb_cpu_prepare() fails to allocate on CPU startup
The per CPU ring buffers are allocated when a new CPU comes online. If the
system is under memory pressure it shouldn't trigger a WARN_ON if the
buffer fails to allocate. Switch the WARN to a pr_warn() message.
- Copy trace_marker to all instances even if one fails
Each instance can set a flag that it wants what is written into the
trace_marker file to be copied to its ring buffer. Currently, if one of
the instances has tracing disabled, the copy will fail. The loop that
copies to each ring buffer detects this failure and stops copying to the
rest of the instances. This is not what is expected as the copy should be
tried to all instances even if it fails on one.
- Prevent perf from using filter logic to read kernel memory
Perf can use filtering on addresses supplied by user space system calls to
look at kernel address space and depending on the result of the filter
determine what was in that address. Prevent perf from this type of filter.
- Fix filter logic on zero length dynamic strings
The string filter match expects the length passed to it to include the nul
terminating byte. Dynamic strings may be zero in length and have no nul
byte. Have the filter logic for this strings pass in an empty string ("")
instead.
- Fix boot filtering on common fields of events
The common fields (like the CPU or PID of the event) are initialized after
boot filtering is processed. This prevents boot filters from using them.
Initialized the common fields before processing the boot filters.
- Fix ref counting of synthetic events
When an instance is removed, it calls clear_event_triggers() on its
events. This function does not properly release the synthetic event ref
counters keeping them "busy" indefinitely. Fix the function to properly
release the reference of the synthetic events they contain.
- Reject the size of zero for histograms
Make it an error if the user tries to create a histogram of size zero. Not
only does it not make sense, it is invalid to call to roundup_pow_of_two()
as it is undefined.
- Fix tail matching of filtering fixed size strings
The filtering of the end of string (*end) does not work properly for fixed
sized string fields. This is because it matches the end of the fixed size
and not the string itself. That is, if a fixed string field of 16 bytes
has "abcd" and the match is to be "cd" the compare is done to the last
three bytes of the 16 (including '\0'), which will likely not be the "cd".
- Fix the filter match of not-equal for out of range CPU masks.
When a compare of a cpumask is out of range, the test returns nr_cpus and
the match function will return zero (not matched) on that. But if the
filter has a negative value (!=) then it should be a match. Fix this by
returning "pred->op == OP_NE" which would return true if it should be a
negative match and false otherwise.
- Fix out-of-bounds read in unfinished filter match
If the filter passed in is "ip ==" without a value after the conditional,
the parsing logic will increment one passed the nul byte and read the
memory after it, possibly reading out-of-bounds memory. Detect this case
and return an error immediately.
- Fix false success when failing on filtering of system groups
A filter may be placed on a system group where the filter is then applied
to each event. This returns success if at least one event succeeds. But
the logic in the loop of all events reset the failure condition at the end
of each iteration meaning that it would always return success even if no
event was successful at applying it. The only way it would fail is if the
first event failed on a memory issue.
- Free created option descriptors on instance creation failure
If an instance were to fail to be created after creating its options, it
would then leak them. Clean them up on failure.
- Allocate shadow stacks inline when enabling function graph hooks
The current method of allocating the shadow stacks used by function graph
(and which is now the backend of kretprobes), allocates 32 stacks,
iterates over all tasks under an RCU lock and adds the stacks to the tasks
that do not have them yet. After it has depleted and assigned all 32
stacks, it would break out of the loop, allocate another 32 stacks and
repeat. Unfortunately, this meant that it would iterate all the tasks it
had already assigned stacks to before assigning new stacks. For machines
running 1000s of tasks, this would take an exponential time to complete.
This logic was created when the loop of all tasks required more locking
and allocating during the loop wasn't recommended. Instead, still allocate
the 32 stacks outside the RCU atomic but only use them if the allocation
of a stack with GFP_NOWAIT fails. This brings down the time to enable a
kretprobe from over 200 seconds down to 0.92 seconds on a machine with
400,000 tasks.
- Do not start kthread in timerlat user space mode
Timerlat has a mode that you can assign a user space task to it. Normally
the code would not start a kernel thread in this case, but if a CPU comes
online, it does not check if its in user space mode and starts a kernel
thread regardless. This triggers a WARN_ON on clean up as timerlat is not
expecting to have a kernel thread running. Prevent kernel thread start up
when a CPU comes on line while timerlat is in user space mode.
- Do not free user events when an event probe is attached to it
Event probes can attach to any other event. User events are events created
that can be controlled by user space. Event probes can attach to these
events, but they currently do not add a reference to them when they do.
This means that the user event can be destroyed leaving the event probe
attached to a stale event which can cause a use-after-free bug.
On destruction of the user event, return -EBUSY if there's a dynamic event
attached to it. Also make it persistent so that the event can be destroyed
once the last fd is closed for it.
- Synchronize the clearing of the copy marker flag
The marker_copies link list contains all the instances that are to copy
the trace_marker writes. When the flag is cleared, and the instance is
removed from the list, wait an RCU synchronization, otherwise if the flag
is set again, it can cause the same write to be written twice as the
instance would be added to the end of the list and a current copy walk of
the list would hit the same instance again.
- Use copy_from_user() and not __copy_from_user() when reading user addresses
When a system call event reads the user space address (like reading the
path string of an openat system call), it users __copy_from_user() which
assumes the address has been verified. Use the copy_from_user() function
instead to verify that the address is OK for user space to read. Note,
this has no security concern as this data read is only visible by the
tracing system which in turn is only visible by admins.
- Fix shadow stack marking of the function graph infrastructure
An old implementation of the shadow stack set bit zero of the shadow stack
frame to denote tail function calls. This is no longer the case and the
setting of the bit can trigger a WARN_ON in some cases.
- Do not do a reader-page swap when head is on tail
The remote ring buffer does not handle swapping the buffer when the head
is on the tail page. Prevent it from happening.
- Fix race between reader and writer of remote ring buffer reader page
When there's data in the buffer, the reader first checks the meta page
counter and then reads the data on the page. But because the writer
updates the content of the pages before updating the meta data, the reader
receives NULL unexpectedly. Swap the checks around so that the reader
still returns the data if there is some before checking the meta data.
Also fix the data ordering of remote buffer page time accounting.
- Fix wrong unit used in hwlat tracer accounting
The tr->max_latency stores nanoseconds (even though its updated from user
space in microseconds, but its converted over). The hwlat tracer assumes
that the tr->max_latency is in microseconds and updates it accordingly.
This causes the output to user space to be off by 1000. Do all
calculations in the hwlat in nanoseconds.
- Properly match filter strings that start with numbers
The set_ftrace_fiter file can take numbers to set functions via an index
into the file instead of having to search all tens of thousands of files
for a match. This code is shared with the event filtering logic as well.
But this caused some of the event filters to get confused by strings
matching numbers and turning it into an index which did not apply to
events.
Have the function tracing handle indexes directly and remove that logic
from the event filtering so that the indexing only affects the
set_ftrace_filter file and nothing else.
- Protect the ring_buffer ioctl from concurrent readers
The ring_buffer ioctl call that maps the ring buffer can race with
concurrent readers. Have it take the trace_access_lock().
- Prevent user events from defining a system name
Currently, user events is the one dynamic event that does not allow the
API from defining its own system (all user events go into the
"user_events" system). But nothing prevents the user from trying to create
one. As systems are denoted with '/' to separate the system from the event
name, the API simply takes the entire string (the '/' and all) as the
event name and tries to create a file with it. This causes the tracefs
file system to be corrupted.
Have the system call fail with -EINVAL if '/' is used.
- Do not use si_mem_available() in early boot for ring_buffer allocation
When allocating the ring buffer, the amount allocated is compared to the
amount of memory available so that it doesn't allocate too much and cause
a system failure. It uses si_mem_available() to get an approximate amount
of memory it can allocate. On systems with CONFIG_DEFERRED_STRUCT_PAGE_INIT
and on early boot up, the value returned by si_mem_available() is derived
by NR_FREE_PAGES and can under report the amount of free memory. This
makes it nearly impossible to allocate the ring buffer and do early boot
tracing on these systems.
For this case, use LONG_MAX as the maximum amount available. If it
allocates too much and crashes the system, that's on the sysadmin that
asked for too much memory for the ring buffer on the kernel command line.
- Add notrace to event functions that use function hooks
A few options in the event code hooks into the ftrace function hook
mechanism. These functions must be marked with notrace. When
CONFIG_FUNCTION_SELF_TRACING is enabled, event functions can be traced by
ftrace and because these functions are not marked as notrace when they are
traced, it causes an infinite loop and the system triple faults. Normally
this wasn't a problem because without the SELF_TRACING set, all files in
the tracing directory are marked as notrace.
Mark the individual functions that are used in the event code with ftrace
as notrace so that the rest of the code can still be traced by ftrace.
- Ignore .function field modifier if the event is already a function event
Perf can hook to the ftrace function event which is special and is marked
as a "function" event where its fields can be filtered against function
names. If the perf uses adds a filter to the ftrace event and adds the
".function" modifier (which converts the field to a function field to be
searched with function names), the double conversion confuses the logic as
the code for the ".function" does not work with function events (only
normal events with unsigned long fields). This can end up with a NULL
pointer dereference.
If the ".function" modifier is used on a function event, simply ignore it,
as the processing will work the same.
Please pull the latest trace-v7.4-rc3 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace-v7.4-rc3
Tag SHA1: 1de700af938ed37450886b4f4708d945709b505b
Head SHA1: 56ce4ed6316cae9536ea891d6686b92f1d930c00
Amit Machhiwal (1):
ring-buffer: Do not check si_mem_available() before deferred init completes
Baek Kyu, Kim (1):
tracing: Free tracer resources on instance creation failure
Breno Leitao (1):
fgraph: Do not mark index 0 in every shadow stack frame
Brian Norris (2):
tracing: Properly match strings that start with numbers
tracing: Add tests for globbing number-based strings
Chaosheng Qu (1):
tracing/osnoise: Don't start a kthread in timerlat user-space mode
Christian Aurich Zanettini Martins (1):
ring-buffer: Do not WARN when trace_rb_cpu_prepare() fails to allocate
David Carlier (4):
tracing: Define common event fields before enabling boot events
tracing: Drop the synthetic event ref when clearing hist triggers
tracing/user_events: Don't free an event that a dynamic event still references
tracing: Ignore .function on the function trace event
Jaewon Jung (2):
tracing: Keep copying markers when one instance is stopped
tracing: Avoid undefined shifts for zero histogram map size
Kyle Zeng (3):
tracing: Restrict perf filters that read kernel strings
tracing/filters: Treat zero-length dynamic strings as empty
tracing: Validate user addresses in faultable buffer copies
Masami Hiramatsu (Google) (4):
tracing/filters: Fix MATCH_END_ONLY regex matching for fixed-size strings
tracing/filters: Handle out-of-range CPU for OP_NE in cpumask comparison
tracing/filters: Check for missing operand after operator in parse_pred()
tracing/filters: Fix false success return in process_system_preds()
Pengfei Li (1):
tracing: Wait for marker writers when copy_trace_marker is cleared
Steven Rostedt (3):
fgraph: Read the task->ret_stack with a smp_load_acquire()
tracing: Do not allow user events to add a system name
tracing: Add notrace to event functions that hook to ftrace
Vincent Donnefort (5):
ring-buffer: Skip remote reader page swap when on tail
ring-buffer: Check remote reader page commit before meta entries
ring-buffer: Order remote page commit with data and timestamp
ring-buffer: Increment pages_read on remote ring buffer page swap
tracing: Take trace_access_lock() in tracing_buffers_ioctl()
Vineet Gupta (2):
fgraph: Allocate shadow stacks inline with GFP_NOWAIT
fgraph: Use scoped_guard() for the task list walk
Wenwu Hou (1):
tracing/hwlat: Do the latency calculations in nanoseconds
----
kernel/trace/fgraph.c | 59 +++++-----
kernel/trace/ftrace.c | 3 +-
kernel/trace/ring_buffer.c | 60 +++++++---
kernel/trace/simple_ring_buffer.c | 26 +++-
kernel/trace/trace.c | 45 ++++---
kernel/trace/trace.h | 3 +-
kernel/trace/trace_events.c | 8 +-
kernel/trace/trace_events_filter.c | 203 +++++++++++++++++++++++++++-----
kernel/trace/trace_events_filter_test.h | 12 +-
kernel/trace/trace_events_hist.c | 25 ++--
kernel/trace/trace_events_trigger.c | 2 +
kernel/trace/trace_events_user.c | 12 ++
kernel/trace/trace_hwlat.c | 41 ++++---
kernel/trace/trace_osnoise.c | 8 ++
14 files changed, 375 insertions(+), 132 deletions(-)
---------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [GIT PULL] tracing: Fixes for v7.4
2026-11-21 12:57 Steven Rostedt
@ 2026-11-21 23:24 ` pr-tracker-bot
0 siblings, 0 replies; 3+ messages in thread
From: pr-tracker-bot @ 2026-11-21 23:24 UTC (permalink / raw)
To: Steven Rostedt
Cc: Linus Torvalds, LKML, Masami Hiramatsu, Mathieu Desnoyers,
Amit Machhiwal, Baek Kyu, Kim, Breno Leitao, Brian Norris,
Chaosheng Qu, Christian Aurich Zanettini Martins, David Carlier,
Jaewon Jung, Kyle Zeng, Pengfei Li, Vincent Donnefort,
Vineet Gupta, Wenwu Hou
The pull request you sent on Sat, 21 Nov 2026 07:57:39 -0500:
> git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git trace-v7.4-rc3
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/e572847ee4d074c9947e8367d150b81775a7e903
Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-27 22:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27 22:29 [GIT PULL] tracing: Fixes for v7.4 Steven Rostedt
-- strict thread matches above, loose matches on Subject: below --
2026-11-21 12:57 Steven Rostedt
2026-11-21 23:24 ` pr-tracker-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®