From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Carlier <devnexen@gmail.com>, Lee Jones <lee@kernel.org>,
Vincent Donnefort <vdonnefort@google.com>
Subject: [for-linus][PATCH 0/8] tracing: Fixes for v7.4
Date: Thu, 03 Dec 2026 09:17:25 -0500 [thread overview]
Message-ID: <20261203141725.845506016@kernel.org> (raw)
tracing fixes for v7.4:
- Fix lseek crash when reading recursed_functions file
The recursed_functions file used the normal seq_lseek method for its lseek
handler but if the file is open for WRONLY the seq isn't initialized and
a call to lseek causes a NULL pointer dereference.
- Fix filter glob matching on zero size strings
Dynamic strings send a length of zero to the match functions to denote
that the string is nul terminated and dynamic in size. But an update
switched the regex_match_glob() handler to use glob_match_len() which
expects a real length of the string. If len is zero, call the original
glob_match() that expects a nul terminated string.
- Use irqsave for reader lock in ring_buffer_poll_remote()
The reader_lock can be taken in interrupt context and there's some places
in the code that takes the reader_lock without disabling interrupts.
- Avoid reader_lock deadlock during panic
On panic, a ftrace dump can be called to see what lead up to the crash.
Like in doing the dump from NMI, the reader_lock is not taken (a best
effort is used to dump out the buffer when the system has crashed).
Do not take the reader lock if the system is in panic.
- Reject non-string fields for synthetic string fields
A synthetic event is created via commands to the synthetic_event file. The
commands specify fields for the new event and their types. Then events can
trigger these synthetic events based on various conditions and pass their
fields as the synthetic event fields. Reject non-string fields being used
in synthetic string fields.
- Free event filters after RCU synchronization
Event filters are protected by RCU and when the internal code is done with
a filter, it tries to do a "delayed free" where it allocates a descriptor
to be used in an RCU and work queue lists and attaches the filter to it.
Then it calls an RCU callback that processes this descriptor. If the
descriptor fails to allocate, it then does the synchronization directly
and then frees the filters.
The issue is that filters can be freed from global functions that can be
called from atomic context and these functions can not do the
synchronization if the allocation of the descriptor fails. As they
currently just free the filters, this is a bug as it leaves a race where
the filters could still be used as no synchronization has taken place.
Instead of allocating a separate descriptor to hold the RCU and work queue
fields in a structure, just add those fields to the event_filter structure
and always do the RCU call to free the filters.
Not only does this fix the bug, it also simplifies the code and makes it a
little smaller.
- Fix trace_event_file leak on read-only instances
When an instance is deleted it removes the files that were created from
the eventfs file system. Since several files share the same descriptor
that needs to be freed, only one of the registered files need to have a
"release" method to delete the descriptor. The "enable" file was chosen as
all events had this file. When the "enable" file is deleted, its release
handler would be called and the descriptor would be freed.
The issue is the introduction of read-only instances that did not have an
"enable" file. When these instances are deleted, the file descriptors were
not freed due to none of the registered files having a release method.
Since all events have a "format" file for both read-only and normal
instances, use that file instead for the release method.
- Fix the "free on close" for backup instances
Backup instances are copies of the persistent ring buffer that is copied
on boot up so that the persistent ring buffer content can be saved and
then the persistent ring buffer can be used immediately without losing the
data from the previous boot.
The backup instance has a feature that can be set to free it after the
last event in its buffer has been read. There's no reason to keep a backup
instance around that is empty as they are read-only and can not add more
data to them.
When the last bit of data is read the instance is marked as freed and any
new open returns -ENODEV. The issue has been reported by user space
applications that read multiple files in the instance directory looking
for things like stats and such. When the last event is read the instance
is marked as freed even before the file descriptors opened are not closed
yet. The instance can not be freed because of open file descriptors but
none of its files can be open again.
Introduce another state to the instance that is autoremove_queued. In this
state, files can still be opened, but once the last file is closed the
instances is removed and nothing can then open a new file.
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/fixes
Head SHA1: a6a40ab36abb91e698b08cc7a0d3dc9455fcfaf4
David Carlier (2):
tracing/filters: Fix glob matching on zero size string fields
tracing: Fix trace_event_file leak on read-only instances
Lee Jones (1):
tracing/histograms: Reject non-string fields for synthetic string fields
Masami Hiramatsu (Google) (1):
tracing: Reject backup instance opens only after autoremove is queued
Steven Rostedt (2):
tracing: Fix crash on lseek of recursed_functions file in WRONLY mode
tracing: Free all event filters after RCU synchronization
Vincent Donnefort (2):
ring-buffer: Use irqsave for the reader lock in ring_buffer_poll_remote
ring-buffer: Avoid reader_lock deadlock during panic
----
kernel/trace/ring_buffer.c | 16 ++--
kernel/trace/trace.c | 12 ++-
kernel/trace/trace.h | 9 ++
kernel/trace/trace_events.c | 6 +-
kernel/trace/trace_events_filter.c | 157 ++++++++++++----------------------
kernel/trace/trace_events_hist.c | 11 ++-
kernel/trace/trace_recursion_record.c | 2 +-
7 files changed, 93 insertions(+), 120 deletions(-)
next reply other threads:[~2026-12-03 14:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 14:17 Steven Rostedt [this message]
2026-12-03 14:17 ` [for-linus][PATCH 1/8] tracing: Fix crash on lseek of recursed_functions file in WRONLY mode Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 2/8] tracing/filters: Fix glob matching on zero size string fields Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 3/8] ring-buffer: Use irqsave for the reader lock in ring_buffer_poll_remote Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 4/8] ring-buffer: Avoid reader_lock deadlock during panic Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 5/8] tracing/histograms: Reject non-string fields for synthetic string fields Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 6/8] tracing: Free all event filters after RCU synchronization Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 7/8] tracing: Fix trace_event_file leak on read-only instances Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 8/8] tracing: Reject backup instance opens only after autoremove is queued Steven Rostedt
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=20261203141725.845506016@kernel.org \
--to=rostedt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=devnexen@gmail.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=vdonnefort@google.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