diff options
| author | Vincent Donnefort <vdonnefort@google.com> | 2026-11-13 15:27:10 +0000 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2026-11-20 10:02:37 -0500 |
| commit | 2a6d7231c79ecb0e6a1d4e6549302e0c47175d22 (patch) | |
| tree | f943a90106cd100f34fbdf5468eb24d9ffa6c6ca /rust/kernel/alloc/allocator | |
| parent | 65f42f1fa03829e0ab1473369461a7aabf525cb2 (diff) | |
ring-buffer: Skip remote reader page swap when on tail
When the reader page is also the tail, swap should not be permitted or
it would insert the tail behind the head, breaking the integrity of the
ring buffer. While __rb_get_reader_page() does correctly prevent this
situation, the simple_ring_buffer implementation misses it.
Once the reader catches up with the tail, make
simple_ring_buffer_swap_reader_page() return 0. The remote reader now
can expect an unchanged reader. When it is the case, there's nothing
more to read.
Also, when the simple_ring_buffer writer moves the tail to a new page,
it resets the new tail counters and more specifically page::commit. As
moving the tail unblocks page swap, order the page reset before the
tail_page update. This ensures the reader can't swap the reader page
with the new tail and observe a stale commit value.
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261113152729.837429-2-vdonnefort@google.com
Fixes: 2e67fabd8b77 ("ring-buffer: Introduce ring-buffer remotes")
Fixes: 34e5b958bdad ("tracing: Introduce simple_ring_buffer")
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'rust/kernel/alloc/allocator')
0 files changed, 0 insertions, 0 deletions
