[PATCH v1 0/4] ring-buffer: Fix remote reader page swap and memory ordering
From: Vincent Donnefort
Date: Fri Nov 13 2026 - 15:12:32 EST
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