Skip to content

tracing: Fixes for v6.15

Steven Rostedt lkml stable 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7ftrace: Initialize variables for ftrace_startup/shutdown_subops()kernel/trace/ftrace.c+4 -40 replies
2/7ftrace: Reinitialize hash to EMPTY_HASH after freeingkernel/trace/ftrace.c+4 -00 replies
3/7ftrace: Free ftrace hashes after they are replaced in the subops codekernel/trace/ftrace.c+7 -10 replies
4/7ftrace: fix incorrect hash size in register_ftrace_direct()kernel/trace/ftrace.c+4 -30 replies
5/7ftrace: Fix type of ftrace_graph_ent_entry.depthkernel/trace/trace_entries.h+2 -20 replies
6/7tracing: Fix filter string testingkernel/trace/trace_events_filter.c+2 -20 replies
7/7tracing: selftests: Add testing a user string to filterstools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc+20 -00 replies

Reviews trailers per patch

1 of 7 patches has a Reviewed-by or Acked-by.

PatchVenkat Rao BagalkoteMasami Hiramatsu (Google)
1/7T-b
2/7
3/7
4/7A-b
5/7
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [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(-)