Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH v1 0/9] ring-buffer: Enable Clang context analysis
@ 2026-11-12 14:14 Vincent Donnefort
  2026-11-12 14:14 ` [PATCH v1 1/9] ring-buffer: Always read buffer->buffers after testing the cpumask Vincent Donnefort
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Vincent Donnefort @ 2026-11-12 14:14 UTC (permalink / raw)
  To: rostedt, mhiramat, linux-trace-kernel
  Cc: mathieu.desnoyers, kernel-team, linux-kernel, Vincent Donnefort

trace_buffer::subbuf_order has caused several recent resize races from
unguarded reads outside buffer->mutex. To prevent further regressions at
build time, enable Clang context analysis for the ring buffer and guard
subbuf_order with __guarded_by(&mutex).

  - Patches 1-3: Fix cpumask/hotplug races around buffer->buffers and
    trace_rb_cpu_prepare().
  - Patch 4: Fix a trace_marker resize race.
  - Patches 5-7: Remove subbuf_order reads from the write path.
  - Patches 8-9: Enable context analysis on ring_buffer.o and annotate
    subbuf_order with __guarded_by(&mutex).

Note: Patch 5 conflicts with the series removing absolute timestamps
[1], though both are independent on v7.4-rc1.

[1] https://lore.kernel.org/20261105202814.1350312-1-vdonnefort@google.com/

Vincent Donnefort (9):
  ring-buffer: Always read buffer->buffers after testing the cpumask
  ring-buffer: Drop cpus_read_lock() from ring_buffer_poll_remote()
  ring-buffer: Hold buffer->mutex in trace_rb_cpu_prepare()
  tracing: Cache ring_buffer_max_event_size() for trace_marker
  ring-buffer: Validate event length against rb_page_capacity()
  ring-buffer: Introduce rb_start_write() and rb_end_write()
  ring-buffer: Avoid reading buffer::subbuf_order on the write path
  ring-buffer: Enable context analysis
  ring-buffer: Annotate subbuf_order with __guarded_by(&mutex)

 kernel/trace/Makefile      |   2 +
 kernel/trace/ring_buffer.c | 350 ++++++++++++++++++++-----------------
 kernel/trace/trace.c       |   9 +-
 3 files changed, 193 insertions(+), 168 deletions(-)


base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.56.0.567.gdb80ae8cd5-goog


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-11-12 14:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 14:14 [PATCH v1 0/9] ring-buffer: Enable Clang context analysis Vincent Donnefort
2026-11-12 14:14 ` [PATCH v1 1/9] ring-buffer: Always read buffer->buffers after testing the cpumask Vincent Donnefort
2026-11-12 14:22   ` sashiko-bot
2026-11-12 14:14 ` [PATCH v1 2/9] ring-buffer: Drop cpus_read_lock() from ring_buffer_poll_remote() Vincent Donnefort
2026-11-12 14:14 ` [PATCH v1 3/9] ring-buffer: Hold buffer->mutex in trace_rb_cpu_prepare() Vincent Donnefort
2026-11-12 14:14 ` [PATCH v1 4/9] tracing: Cache ring_buffer_max_event_size() for trace_marker Vincent Donnefort
2026-11-12 14:25   ` sashiko-bot
2026-11-12 14:14 ` [PATCH v1 5/9] ring-buffer: Validate event length against rb_page_capacity() Vincent Donnefort
2026-11-12 14:14 ` [PATCH v1 6/9] ring-buffer: Introduce rb_start_write() and rb_end_write() Vincent Donnefort
2026-11-12 14:14 ` [PATCH v1 7/9] ring-buffer: Avoid reading buffer::subbuf_order on the write path Vincent Donnefort
2026-11-12 14:14 ` [PATCH v1 8/9] ring-buffer: Enable context analysis Vincent Donnefort
2026-11-12 14:28   ` sashiko-bot
2026-11-12 14:14 ` [PATCH v1 9/9] ring-buffer: Annotate subbuf_order with __guarded_by(&mutex) Vincent Donnefort

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox