linux/samples
Linus Torvalds 081e5bf2a9 tracing updates for v7.3:
- Expose btf_ids to trace events
 
   In order to allow BPF programs to attach to system call trace events (which
   are actually pseudo trace events built on top of raw_syscall events),
   expose the BTF ID of the events. This will allow BPF programs better
   precision in attaching to events.
 
 - Use "u64" to assign to hist_field->type
 
   Instead of using kstrdup("u64", GFP_KERNEL) to assign the hist_field->type,
   just point it to "u64" instead. The hist_field->type is freed via
   kfree_const().
 
 - Replace kmalloc()/strcpy() with kstrdup() for trace_printk
 
   Instead of having two calls to copy the module format string, just use
   kstrdup().
 
 - Use __free() in trace event histograms and triggres where possible
 
 - Use seq_buf in trace event code instead of strcat()
 
   Instead of calculating the size of the buffer to use and filling it with
   strcat(), use the seq_buf infrastructure that takes care of making sure
   not to overflow the string size.
 
 - Reject invalid preemptirq_delay_test CPU affinity
 
   The preempt_delay_test module can take an invalid CPU affinity mask and
   create confusing output. Simply have the module reject invalid affinity
   masks.
 
 - Prevent division by zero in ftrace_ops sample module code
 
   If the ftrace_ops sample module code receives the module parameter
   nr_function_calls set to zero, it can cause a division by zero error.
 
 - Warn when an event dereferences a parameter in TP_printk()
 
   On boot up and module load, the trace event TP_printk() is scanned for
   possible bugs. As the TP_printk() code is executed when the user reads the
   "trace" file and processes the data written when the trace_event executed,
   the data it reads can be literally days old. The scan currently checks for
   dereferencing printk formats like "%pI6". But it does not check if the
   parameters themselves have a dereference like:
 
   TP_printk("offset %08x: value %08x",
            (u32)(__entry->addr - __entry->edma->membase), __entry->value)
 
   __entry represents the pointer to the event on the ring buffer. The
   __entry->edma->membase is dereferencing a pointer on the ring buffer to
   find membase, but the __entry->edma may no longer be a valid pointer.
 
   Warn on this case too.
 
 - Replace some strcpy() with strscpy()
 
 - Clean up mmiotrace events to use assign_type() macro
 
   The assign_type() macro makes sure the event type is indeed the type that
   is being parsed. The mmiotrace trace was written before that macro was
   created so it just simply typecasted the pointer.
 
   Replace the typecasting with the macro.
 
 - Have the ENUM processing to numbers only process what is added
 
   The code that converts ENUMs to their numbers in the trace events scanned
   all events to do the processing. This was true when a module was loaded
   too. That is, instead of processing just the events for the module, it
   processed *all* events. Even the builtin ones that were processed at boot
   up.
 
   Add a check for the event->module matching mod if it is a module before
   processing it.
 -----BEGIN PGP SIGNATURE-----
 
 iIoEABYKADIWIQRRSw7ePDh/lE+zeZMp5XQQmuv6qgUCan+WhRQccm9zdGVkdEBn
 b29kbWlzLm9yZwAKCRAp5XQQmuv6qk1sAQDIvuux39ii379T9hTm7hgXF9Dr8aH7
 RgxILUmr3c4y6QD+Iv9QQto+NfauqjkEMdPuVdOyUpDCYPTRw9i/YCty7Qk=
 =vya7
 -----END PGP SIGNATURE-----

Merge tag 'trace-v7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull tracing updates from Steven Rostedt:

 - Expose btf_ids to trace events

   In order to allow BPF programs to attach to system call trace events
   (which are actually pseudo trace events built on top of raw_syscall
   events), expose the BTF ID of the events. This will allow BPF
   programs better precision in attaching to events.

 - Use "u64" to assign to hist_field->type

   Instead of using kstrdup("u64", GFP_KERNEL) to assign the
   hist_field->type, just point it to "u64" instead. The
   hist_field->type is freed via kfree_const().

 - Replace kmalloc()/strcpy() with kstrdup() for trace_printk

   Instead of having two calls to copy the module format string, just
   use kstrdup().

 - Use __free() in trace event histograms and triggres where possible

 - Use seq_buf in trace event code instead of strcat()

   Instead of calculating the size of the buffer to use and filling it
   with strcat(), use the seq_buf infrastructure that takes care of
   making sure not to overflow the string size.

 - Reject invalid preemptirq_delay_test CPU affinity

   The preempt_delay_test module can take an invalid CPU affinity mask
   and create confusing output. Simply have the module reject invalid
   affinity masks.

 - Prevent division by zero in ftrace_ops sample module code

   If the ftrace_ops sample module code receives the module parameter
   nr_function_calls set to zero, it can cause a division by zero error.

 - Warn when an event dereferences a parameter in TP_printk()

   On boot up and module load, the trace event TP_printk() is scanned
   for possible bugs. As the TP_printk() code is executed when the user
   reads the "trace" file and processes the data written when the
   trace_event executed, the data it reads can be literally days old.
   The scan currently checks for dereferencing printk formats like
   "%pI6". But it does not check if the parameters themselves have a
   dereference like:

	TP_printk("offset %08x: value %08x",
		(u32)(__entry->addr - __entry->edma->membase), __entry->value)

   __entry represents the pointer to the event on the ring buffer. The
   __entry->edma->membase is dereferencing a pointer on the ring buffer
   to find membase, but the __entry->edma may no longer be a valid
   pointer.

   Warn on this case too.

 - Replace some strcpy() with strscpy()

 - Clean up mmiotrace events to use assign_type() macro

   The assign_type() macro makes sure the event type is indeed the type
   that is being parsed. The mmiotrace trace was written before that
   macro was created so it just simply typecasted the pointer.

   Replace the typecasting with the macro.

 - Have the ENUM processing to numbers only process what is added

   The code that converts ENUMs to their numbers in the trace events
   scanned all events to do the processing. This was true when a module
   was loaded too. That is, instead of processing just the events for
   the module, it processed *all* events. Even the builtin ones that
   were processed at boot up.

   Add a check for the event->module matching mod if it is a module
   before processing it.

* tag 'trace-v7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: (21 commits)
  tracing: Have trace_event_update_all() only handle module that is loading
  tracing: Cleanup event_enable_trigger_parse() by using __free()
  tracing: Report every TP_printk double dereference
  tracing/mmiotrace: Use trace_assign_type() in mmio_print_mark()
  tracing: Make per-template BTF id lists file-local
  tracing: Use seq_buf for string concatenation
  tracing: Use strscpy() instead of strcpy() in trace_sched_switch
  tracing: Warn when an event dereferences a pointer in TP_printk()
  samples/ftrace: Prevent division by zero when nr_function_calls is zero
  tracing: Reject invalid preemptirq_delay_test CPU affinity
  fgraph: Use trace_seq_putc() in print_graph_return()
  tracing/user_events: Replace a seq_printf() call by seq_puts() in user_seq_show()
  tracing/user_events: Use seq_putc() in two functions
  tracing: Bound histogram expression strings with seq_buf
  tracing: Return ERR_PTR() from expr_str()
  tracing: Use __free() for expr_str() buffer
  kernel/trace/trace_printk: Use kstrdup() instead of kmalloc() and strcpy()
  tracing: Point constant hist field type to string literal
  selftests/bpf: Add test for tracepoint btf_ids tracefs file
  tracing: Expose tracepoint BTF ids via tracefs
  ...
2026-08-19 14:06:14 -07:00
..
acrn virt: acrn: Fix typos 2024-05-04 18:59:44 +02:00
auxdisplay
binderfs
bpf samples/bpf: Fix spelling typos in samples/bpf 2025-10-18 19:26:23 -07:00
cgroup samples/cgroup: rm unused MEMCG_EVENTS macro 2025-09-21 14:22:26 -07:00
check-exec samples/check-exec: Fix script name 2025-03-07 19:58:05 -08:00
configfs samples: configfs: Constify struct configfs_item_operations and configfs_group_operations 2026-01-15 09:27:27 +01:00
connector treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
coresight
damon samples/damon/mtier: error out for zero quota goal target values 2026-08-04 20:02:02 -07:00
fanotify samples: fix building fs-monitor on musl systems 2025-07-28 18:14:15 +02:00
fprobe fprobe: Use ftrace_regs in fprobe exit handler 2024-12-26 10:50:03 -05:00
ftrace samples/ftrace: Prevent division by zero when nr_function_calls is zero 2026-07-28 07:18:50 -04:00
hid samples/hid: fix broken vmlinux path for VMLINUX_BTF 2025-02-04 11:07:41 +01:00
hidraw
hung_task samples: enhance hung_task detector test with read-write semaphore support 2025-07-19 19:08:26 -07:00
hw_breakpoint perf/hw_breakpoint: use ERR_PTR_PCPU(), IS_ERR_PCPU() and PTR_ERR_PCPU() macros 2024-11-05 17:12:32 -08:00
kdb
kfifo kfifo: don't include dma-mapping.h in kfifo.h 2024-10-23 08:05:20 +02:00
kmemleak samples: kmemleak: print the raw pointers for debugging purposes 2025-03-16 22:06:08 -07:00
kobject samples/kobject: Constify kobject attributes 2026-07-11 20:38:01 +02:00
kprobes samples: kprobes: add missing MODULE_DESCRIPTION() macros 2024-06-12 08:44:27 +09:00
landlock samples/landlock: Add quiet flag support to sandboxer 2026-06-14 20:17:20 +02:00
livepatch samples/livepatch: add module descriptions 2025-04-11 17:32:38 -07:00
mei samples: mei: Fix building on musl libc 2025-07-16 14:17:47 +02:00
nitro_enclaves
pfsm
pidfd
pktgen samples: pktgen: correct dev to DEV 2024-11-13 18:54:33 -08:00
qmi samples: qmi: Use the unified QMI service ID instead of defining it locally 2026-03-15 20:54:39 -05:00
rpmsg
rust rust: driver: remove $module_table_name from module_device_table 2026-07-30 22:50:15 +02:00
seccomp samples: user-trap: fix strict-aliasing warning 2024-02-12 10:42:02 -08:00
timers
trace_events tracing/events: Fix to check the simple_tsk_fn creation 2026-06-30 23:58:19 +09:00
trace_printk
tsm-mr sample/tsm-mr: Use SHA-2 library APIs 2026-03-19 10:57:15 -07:00
uhid
user_events
v4l media: v4l2-pci-skeleton: Rename second ioctl handlers argument to 'void *priv' 2025-08-13 08:33:59 +02:00
vfio-mdev vfio: Adapt drivers to use the core helper vfio_check_precopy_ioctl 2026-03-19 12:32:09 -06:00
vfs Significant patch series in this pull request: 2025-12-06 14:01:20 -08:00
watch_queue samples: work around glibc redefining some of our defines wrong 2025-11-21 09:29:02 -08:00
watchdog
workqueue/stall_detector workqueue: Add stall detector sample module 2026-03-05 07:30:49 -10:00
Kconfig sample/tsm-mr: Use SHA-2 library APIs 2026-03-19 10:57:15 -07:00
Makefile - The 11 patch series "Add folio_mk_pte()" from Matthew Wilcox 2025-05-31 15:44:16 -07:00