[for-linus][PATCH 0/9] tracing: Fixes and cleanups for v6.11
From: Steven Rostedt
Date: Thu Aug 08 2024 - 10:21:31 EST
tracing fixes for v6.11:
- Have reading of event format files test if the meta data still exists.
When a event is freed, a flag (EVENT_FILE_FL_FREED) in the meta data is
set to state that it is to prevent any new references to it from happening
while waiting for existing references to close. When the last reference
closes, the meta data is freed. But the "format" was missing a check to
this flag (along with some other files) that allowed new references to
happen, and a use-afte-free bug to occur.
- Have the trace event meta data use the refcount infrastructure instead
of relying on its own atomic counters.
- Have tracefs inodes use alloc_inode_sb() for allocation instead of
using kmem_cache_alloc() directly.
- Have eventfs_create_dir() return an ERR_PTR instead of NULL as
the callers expect a real object or an ERR_PTR.
- Have release_ei() use call_srcu() and not call_rcu() as all the
protection is on SRCU and not RCU.
- Fix ftrace_graph_ret_addr() to use the task passed in and not current.
- Fix overflow bug in get_free_elt() where the counter can overflow
the integer and cause an infinite loop.
- Remove unused function ring_buffer_nr_pages()
- Have tracefs freeing use the inode RCU infrastructure instead of
creating its own. When the kernel had randomize structure fields
enabled, the rcu field of the tracefs_inode was overlapping the
rcu field of the inode structure, and corrupting it. Instead,
use the destroy_inode() callback to do the initial cleanup of
the code, and then have free_inode() free it.
Jianhui Zhou (1):
ring-buffer: Remove unused function ring_buffer_nr_pages()
Mathias Krause (3):
tracefs: Fix inode allocation
eventfs: Don't return NULL in eventfs_create_dir()
eventfs: Use SRCU for freeing eventfs_inodes
Petr Pavlu (1):
function_graph: Fix the ret_stack used by ftrace_graph_ret_addr()
Steven Rostedt (3):
tracing: Have format file honor EVENT_FILE_FL_FREED
tracing: Use refcount for trace_event_file reference counter
tracefs: Use generic inode RCU for synchronizing freeing
Tze-nan Wu (1):
tracing: Fix overflow in get_free_elt()
----
fs/tracefs/event_inode.c | 4 ++--
fs/tracefs/inode.c | 12 +++++------
fs/tracefs/internal.h | 5 +----
include/linux/ring_buffer.h | 1 -
include/linux/trace_events.h | 2 +-
kernel/trace/fgraph.c | 2 +-
kernel/trace/ring_buffer.c | 12 -----------
kernel/trace/trace.h | 23 +++++++++++++++++++++
kernel/trace/trace_events.c | 41 ++++++++++++++++++++++---------------
kernel/trace/trace_events_hist.c | 4 ++--
kernel/trace/trace_events_inject.c | 2 +-
kernel/trace/trace_events_trigger.c | 6 +++---
kernel/trace/tracing_map.c | 6 +++---
13 files changed, 66 insertions(+), 54 deletions(-)