2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/kernel/trace
Linus Torvalds e1d8f9ccb2 tracing fixes for v6.17-rc2:
- Fix rtla and latency tooling pkg-config errors
 
   If libtraceevent and libtracefs is installed, but their corresponding '.pc'
   files are not installed, it reports that the libraries are missing and
   confuses the developer. Instead, report that the pkg-config files are
   missing and should be installed.
 
 - Fix overflow bug of the parser in trace_get_user()
 
   trace_get_user() uses the parsing functions to parse the user space strings.
   If the parser fails due to incorrect processing, it doesn't terminate the
   buffer with a nul byte. Add a "failed" flag to the parser that gets set when
   parsing fails and is used to know if the buffer is fine to use or not.
 
 - Remove a semicolon that was at an end of a comment line
 
 - Fix register_ftrace_graph() to unregister the pm notifier on error
 
   The register_ftrace_graph() registers a pm notifier but there's an error
   path that can exit the function without unregistering it. Since the function
   returns an error, it will never be unregistered.
 
 - Allocate and copy ftrace hash for reader of ftrace filter files
 
   When the set_ftrace_filter or set_ftrace_notrace files are open for read,
   an iterator is created and sets its hash pointer to the associated hash that
   represents filtering or notrace filtering to it. The issue is that the hash
   it points to can change while the iteration is happening. All the locking
   used to access the tracer's hashes are released which means those hashes can
   change or even be freed. Using the hash pointed to by the iterator can cause
   UAF bugs or similar.
 
   Have the read of these files allocate and copy the corresponding hashes and
   use that as that will keep them the same while the iterator is open. This
   also simplifies the code as opening it for write already does an allocate
   and copy, and now that the read is doing the same, there's no need to check
   which way it was opened on the release of the file, and the iterator hash
   can always be freed.
 
 - Fix function graph to copy args into temp storage
 
   The output of the function graph tracer shows both the entry and the exit of
   a function. When the exit is right after the entry, it combines the two
   events into one with the output of "function();", instead of showing:
 
   function() {
   }
 
   In order to do this, the iterator descriptor that reads the events includes
   storage that saves the entry event while it peaks at the next event in
   the ring buffer. The peek can free the entry event so the iterator must
   store the information to use it after the peek.
 
   With the addition of function graph tracer recording the args, where the
   args are a dynamic array in the entry event, the temp storage does not save
   them. This causes the args to be corrupted or even cause a read of unsafe
   memory.
 
   Add space to save the args in the temp storage of the iterator.
 
 - Fix race between ftrace_dump and reading trace_pipe
 
   ftrace_dump() is used when a crash occurs where the ftrace buffer will be
   printed to the console. But it can also be triggered by sysrq-z. If a
   sysrq-z is triggered while a task is reading trace_pipe it can cause a race
   in the ftrace_dump() where it checks if the buffer has content, then it
   checks if the next event is available, and then prints the output
   (regardless if the next event was available or not). Reading trace_pipe
   at the same time can cause it to not be available, and this triggers a
   WARN_ON in the print. Move the printing into the check if the next event
   exists or not.
 -----BEGIN PGP SIGNATURE-----
 
 iIoEABYKADIWIQRRSw7ePDh/lE+zeZMp5XQQmuv6qgUCaKnAGRQccm9zdGVkdEBn
 b29kbWlzLm9yZwAKCRAp5XQQmuv6qotPAQD02idezasiFi0vakLTR+0x/uAI2UOL
 5RLfTwmZW7S1FwEAwOvGpKx3k/kUwDp5EReP34A+1Fqyc5Mvps4UCE1s4gM=
 =ENHu
 -----END PGP SIGNATURE-----

Merge tag 'trace-v6.17-rc2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull tracing fixes from Steven Rostedt:

 - Fix rtla and latency tooling pkg-config errors

   If libtraceevent and libtracefs is installed, but their corresponding
   '.pc' files are not installed, it reports that the libraries are
   missing and confuses the developer. Instead, report that the
   pkg-config files are missing and should be installed.

 - Fix overflow bug of the parser in trace_get_user()

   trace_get_user() uses the parsing functions to parse the user space
   strings. If the parser fails due to incorrect processing, it doesn't
   terminate the buffer with a nul byte. Add a "failed" flag to the
   parser that gets set when parsing fails and is used to know if the
   buffer is fine to use or not.

 - Remove a semicolon that was at an end of a comment line

 - Fix register_ftrace_graph() to unregister the pm notifier on error

   The register_ftrace_graph() registers a pm notifier but there's an
   error path that can exit the function without unregistering it. Since
   the function returns an error, it will never be unregistered.

 - Allocate and copy ftrace hash for reader of ftrace filter files

   When the set_ftrace_filter or set_ftrace_notrace files are open for
   read, an iterator is created and sets its hash pointer to the
   associated hash that represents filtering or notrace filtering to it.
   The issue is that the hash it points to can change while the
   iteration is happening. All the locking used to access the tracer's
   hashes are released which means those hashes can change or even be
   freed. Using the hash pointed to by the iterator can cause UAF bugs
   or similar.

   Have the read of these files allocate and copy the corresponding
   hashes and use that as that will keep them the same while the
   iterator is open. This also simplifies the code as opening it for
   write already does an allocate and copy, and now that the read is
   doing the same, there's no need to check which way it was opened on
   the release of the file, and the iterator hash can always be freed.

 - Fix function graph to copy args into temp storage

   The output of the function graph tracer shows both the entry and the
   exit of a function. When the exit is right after the entry, it
   combines the two events into one with the output of "function();",
   instead of showing:

     function() {
     }

   In order to do this, the iterator descriptor that reads the events
   includes storage that saves the entry event while it peaks at the
   next event in the ring buffer. The peek can free the entry event so
   the iterator must store the information to use it after the peek.

   With the addition of function graph tracer recording the args, where
   the args are a dynamic array in the entry event, the temp storage
   does not save them. This causes the args to be corrupted or even
   cause a read of unsafe memory.

   Add space to save the args in the temp storage of the iterator.

 - Fix race between ftrace_dump and reading trace_pipe

   ftrace_dump() is used when a crash occurs where the ftrace buffer
   will be printed to the console. But it can also be triggered by
   sysrq-z. If a sysrq-z is triggered while a task is reading trace_pipe
   it can cause a race in the ftrace_dump() where it checks if the
   buffer has content, then it checks if the next event is available,
   and then prints the output (regardless if the next event was
   available or not). Reading trace_pipe at the same time can cause it
   to not be available, and this triggers a WARN_ON in the print. Move
   the printing into the check if the next event exists or not

* tag 'trace-v6.17-rc2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  ftrace: Also allocate and copy hash for reading of filter files
  ftrace: Fix potential warning in trace_printk_seq during ftrace_dump
  fgraph: Copy args in intermediate storage with entry
  trace/fgraph: Fix the warning caused by missing unregister notifier
  ring-buffer: Remove redundant semicolons
  tracing: Limit access to parser->buffer when trace_get_user failed
  rtla: Check pkg-config install
  tools/latency-collector: Check pkg-config install
2025-08-23 10:11:34 -04:00
..
rv tracing changes for 6.17 2025-08-01 10:29:36 -07:00
blktrace.c Significant patch series in this pull request: 2025-08-03 16:23:09 -07:00
bpf_trace.c bpf: Clean up individual BTF_ID code 2025-07-16 18:34:42 -07:00
bpf_trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
error_report-traces.c
fgraph.c trace/fgraph: Fix the warning caused by missing unregister notifier 2025-08-20 09:21:03 -04:00
fprobe.c Probes updates for v6.17: 2025-07-30 15:38:01 -07:00
ftrace_internal.h function_graph: Make fgraph_update_pid_func() a stub for !DYNAMIC_FTRACE 2024-06-10 18:08:23 -04:00
ftrace.c ftrace: Also allocate and copy hash for reading of filter files 2025-08-22 19:58:35 -04:00
Kconfig tracing changes for 6.17 2025-08-01 10:29:36 -07:00
kprobe_event_gen_test.c
Makefile tracing: Have eprobes have their own config option 2025-07-30 10:38:43 -04:00
pid_list.c tracing: Cleanup upper_empty() in pid_list 2025-05-14 11:19:32 -04:00
pid_list.h
power-traces.c PM: cpufreq: powernv/tracing: Move powernv_throttle trace event 2025-07-21 16:40:56 -04:00
preemptirq_delay_test.c kernel: trace: preemptirq_delay_test: use offstack cpu mask 2025-07-08 18:17:38 -04:00
rethook.c rethook: honor CONFIG_FTRACE_VALIDATE_RCU_IS_WATCHING in rethook_try_get() 2024-05-01 23:18:48 +09:00
ring_buffer_benchmark.c ring-buffer: Use str_low_high() helper in ring_buffer_producer() 2024-10-19 11:12:25 -04:00
ring_buffer.c ring-buffer: Remove redundant semicolons 2025-08-20 09:20:30 -04:00
rpm-traces.c
synth_event_gen_test.c
trace_benchmark.c tracing: Improve benchmark test performance by using do_div() 2024-05-13 20:00:57 -04:00
trace_benchmark.h
trace_boot.c
trace_branch.c tracing: branch: Use trace_tracing_is_on_cpu() instead of "disabled" field 2025-05-09 15:19:10 -04:00
trace_btf.c
trace_btf.h
trace_clock.c tracing: Use atomic64_inc_return() in trace_clock_counter() 2024-10-09 19:59:49 -04:00
trace_dynevent.c tracing: probes: Fix a possible race in trace_probe_log APIs 2025-05-13 22:23:34 +09:00
trace_dynevent.h tracing: probes: Fix a possible race in trace_probe_log APIs 2025-05-13 22:23:34 +09:00
trace_entries.h ftrace: Expose call graph depth as unsigned int 2025-05-08 09:36:08 -04:00
trace_eprobe.c tracing: Have eprobes handle arrays 2025-07-24 22:57:32 +09:00
trace_event_perf.c perf: Remove unnecessary parameter of security check 2025-02-26 14:13:58 -05:00
trace_events_filter_test.h
trace_events_filter.c tracing changes for 6.17 2025-08-01 10:29:36 -07:00
trace_events_hist.c tracing: Rename event_trigger_alloc() to trigger_data_alloc() 2025-05-09 15:19:11 -04:00
trace_events_inject.c tracing: Have format file honor EVENT_FILE_FL_FREED 2024-08-07 18:12:46 -04:00
trace_events_synth.c tracing: Add guard(ring_buffer_nest) 2025-08-01 16:49:15 -04:00
trace_events_trigger.c tracing updates for v6.16: 2025-05-29 21:04:36 -07:00
trace_events_user.c tracing/user_events: Slightly simplify user_seq_show() 2025-03-06 13:35:27 -05:00
trace_events.c tracing changes for 6.17 2025-08-01 10:29:36 -07:00
trace_export.c
trace_fprobe.c tracing: trace_fprobe: Fix typo of the semicolon 2025-07-29 08:37:52 +09:00
trace_functions_graph.c fgraph: Copy args in intermediate storage with entry 2025-08-22 17:32:35 -04:00
trace_functions.c tracing updates for v6.16: 2025-05-29 21:04:36 -07:00
trace_hwlat.c tracing: Replace opencoded cpumask_next_wrap() in move_to_next_cpu() 2025-07-08 18:17:29 -04:00
trace_irqsoff.c tracing: Use atomic_inc_return() for updating "disabled" counter in irqsoff tracer 2025-05-09 15:19:10 -04:00
trace_kdb.c ring-buffer: Remove ring_buffer_read_prepare_sync() 2025-07-22 20:01:41 -04:00
trace_kprobe_selftest.c
trace_kprobe_selftest.h
trace_kprobe.c tracing: kprobe-event: Allocate string buffers from heap 2025-07-24 00:21:44 +09:00
trace_mmiotrace.c tracing/mmiotrace: Remove reference to unused per CPU data pointer 2025-05-08 09:36:09 -04:00
trace_nop.c
trace_osnoise.c tracing/osnoise: Fix crash in timerlat_dump_stack() 2025-07-18 15:51:35 -04:00
trace_output.c tracing: Have unsigned int function args displayed as hexadecimal 2025-08-01 19:14:51 -04:00
trace_output.h ftrace: Add print_function_args() 2025-03-04 11:27:23 -05:00
trace_preemptirq.c tracing: Fix archs that still call tracepoints without RCU watching 2024-12-05 09:28:58 -05:00
trace_printk.c
trace_probe_kernel.h
trace_probe_tmpl.h tracing/fprobe: Enable fprobe events with CONFIG_DYNAMIC_FTRACE_WITH_ARGS 2024-12-26 10:50:04 -05:00
trace_probe.c Probes updates for v6.17: 2025-07-30 15:38:01 -07:00
trace_probe.h tracing: probe: Allocate traceprobe_parse_context from heap 2025-07-24 00:21:30 +09:00
trace_recursion_record.c
trace_sched_switch.c pid: allow pid_max to be set per pid namespace 2024-12-02 11:25:25 +01:00
trace_sched_wakeup.c tracing: Convert the per CPU "disabled" counter to local from atomic 2025-05-09 15:19:10 -04:00
trace_selftest_dynamic.c
trace_selftest.c fgraph: Pass ftrace_regs to retfunc 2024-12-26 10:50:03 -05:00
trace_seq.c
trace_stack.c tracing updates for v6.16: 2025-05-29 21:04:36 -07:00
trace_stat.c tracing: Switch trace_stat.c code over to use guard() 2024-12-26 10:38:37 -05:00
trace_stat.h
trace_synth.h
trace_syscalls.c tracing/perf: Add might_fault check to syscall probes 2024-10-09 17:09:46 -04:00
trace_uprobe.c tracing: uprobe-event: Allocate string buffers from heap 2025-07-24 00:21:58 +09:00
trace.c ftrace: Fix potential warning in trace_printk_seq during ftrace_dump 2025-08-22 17:32:36 -04:00
trace.h tracing fixes for v6.17-rc2: 2025-08-23 10:11:34 -04:00
tracing_map.c tracing: Fix cmp_entries_dup() to respect sort() comparison rules 2024-12-04 10:38:24 -05:00
tracing_map.h