Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH v1 0/4] ring-buffer: Fix remote reader page swap and memory ordering
@ 2026-11-13 15:27 Vincent Donnefort
  2026-11-13 15:27 ` [PATCH v1 1/4] ring-buffer: Skip remote reader page swap when on tail Vincent Donnefort
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Vincent Donnefort @ 2026-11-13 15:27 UTC (permalink / raw)
  To: rostedt, mhiramat, linux-trace-kernel
  Cc: mathieu.desnoyers, kernel-team, linux-kernel, bgrzesik,
	Vincent Donnefort

Bartłomiej reported a remote tracing issue on Android kernel branches.
Although that code differs from mainline, investigating the report
showed that upstream has the same underlying shortfalls:

1. Potential corruption of a simple ring buffer because it does not
   prevent swapping the reader page with the head when the reader page
   is already the tail page (nor order the page::commit reset before
   updating tail_page).

2. Potential failure of rb_advance_reader() because
   __rb_get_reader_page_from_remote() checks rb_num_of_entries() before
   checking the reader page commit via rb_page_size(), and lacks memory
   barriers ordering page::commit and meta::entries.

While at it, order page::commit with page::data and page::time_stamp
(patch 3) and add the missing pages_read increment on remote reader page
swaps (patch 4).

Vincent Donnefort (4):
  ring-buffer: Skip remote reader page swap when on tail
  ring-buffer: Check remote reader page commit before meta entries
  ring-buffer: Order remote page commit with data and timestamp
  ring-buffer: Increment pages_read on remote ring buffer page swap

 kernel/trace/ring_buffer.c        | 46 +++++++++++++++++++++----------
 kernel/trace/simple_ring_buffer.c | 26 ++++++++++++++++-
 2 files changed, 57 insertions(+), 15 deletions(-)


base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.56.0.611.g1030f0b940-goog


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

end of thread, other threads:[~2026-11-13 16:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13 15:27 [PATCH v1 0/4] ring-buffer: Fix remote reader page swap and memory ordering Vincent Donnefort
2026-11-13 15:27 ` [PATCH v1 1/4] ring-buffer: Skip remote reader page swap when on tail Vincent Donnefort
2026-11-13 15:27 ` [PATCH v1 2/4] ring-buffer: Check remote reader page commit before meta entries Vincent Donnefort
2026-11-13 16:03   ` sashiko-bot
2026-11-13 15:27 ` [PATCH v1 3/4] ring-buffer: Order remote page commit with data and timestamp Vincent Donnefort
2026-11-13 15:34   ` sashiko-bot
2026-11-13 15:27 ` [PATCH v1 4/4] ring-buffer: Increment pages_read on remote ring buffer page swap Vincent Donnefort

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