[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250418183446.383784216@goodmis.org>
Date: Fri, 18 Apr 2025 14:34:46 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: linux-kernel@...r.kernel.org
Cc: Masami Hiramatsu <mhiramat@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: [for-linus][PATCH 0/7] tracing: Fixes for v6.15
tracing fixes for v6.15
- Initialize hash variables in ftrace subops logic
The fix that simplified the ftrace subops logic opened a path where some
variables could be used without being initialized, and done subtly where
the compiler did not catch it. Initialize those variables to the
EMPTY_HASH, which is the default hash.
- Reinitialize the hash pointers after they are freed
Some of the hash pointers in the subop logic were freed but may still be
referenced later. To prevent use-after-free bugs, initialize them back to
the EMPTY_HASH.
- Free the ftrace hashes when they are replaced
The fix that simplified the subops logic updated some hash pointers, but
left the original hash that they were pointing to where they are no longer
used. This caused a memory leak. Free the hashes that are pointed to by
the pointers when they are replaced.
- Fix size initialization of ftrace direct function hash
The ftrace direct function hash used by BPF initialized the hash size
incorrectly. It checked the size of items to a hard coded 32, which made
the hash bit size of 5. The hash size is supposed to be limited by the bit
size of the hash, as the bitmask is allowed to be greater than 5. Rework
the size check to first pass the number of elements to fls() and then
compare that to FTRACE_HASH_MAX_BITS before allocating the hash.
- Fix format output of ftrace_graph_ent_entry event
The field depth of the ftrace_graph_ent_entry event is of size 4 but the
output showed it as unsigned long and use "%lu". Change it to unsigned int
and use "%u" in the print format that is displayed to user space.
- Fix the trace event filter on strings
Events can be filtered on numbers or string values. The return value
checked from strncpy_from_kernel_nofault() and strncpy_from_user_nofault()
was used to determine if reading the strings would fault or not. It would
return fault if the value was non zero, which is basically meant that it
was always considering the read as a fault.
- Add selftest to test trace event string filtering
In order to catch the breakage of the string filtering, add a self test to
make sure that it continues to work.
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/fixes
Head SHA1: d481ee35247d2a01764667a25f6f512c292ba42d
Ilya Leoshkevich (1):
ftrace: Fix type of ftrace_graph_ent_entry.depth
Menglong Dong (1):
ftrace: fix incorrect hash size in register_ftrace_direct()
Steven Rostedt (5):
ftrace: Initialize variables for ftrace_startup/shutdown_subops()
ftrace: Reinitialize hash to EMPTY_HASH after freeing
ftrace: Free ftrace hashes after they are replaced in the subops code
tracing: Fix filter string testing
tracing: selftests: Add testing a user string to filters
----
kernel/trace/ftrace.c | 27 +++++++++++++++-------
kernel/trace/trace_entries.h | 4 ++--
kernel/trace/trace_events_filter.c | 4 ++--
.../ftrace/test.d/filter/event-filter-function.tc | 20 ++++++++++++++++
4 files changed, 43 insertions(+), 12 deletions(-)
Powered by blists - more mailing lists