* [PATCH v2] ring-buffer: Skip time delta validation for the counter clock [not found] <CADZg-m04iG5kCZ5-yh=Vz_ysYjVDGSYn3je4_-8AzWWfiC-bXQ@mail.gmail.com> @ 2026-11-04 22:42 ` Kirtikumar Anandrao Ramchandani 2026-11-05 14:07 ` Steven Rostedt 2026-11-05 14:19 ` [PATCH v3] " Kirtikumar Anandrao Ramchandani 0 siblings, 2 replies; 4+ messages in thread From: Kirtikumar Anandrao Ramchandani @ 2026-11-04 22:42 UTC (permalink / raw) To: rostedt, mhiramat Cc: mathieu.desnoyers, linux-trace-kernel, linux-kernel, syzkaller-bugs, syzbot+eb74dca0d1eb3ec227a7 The counter trace clock increments on every read. Time delta validation assumes that the clock values read while reserving and checking an event can be reconciled with the deltas stored in the page. With the counter clock, this assumption can fail for an intact ring buffer and report a spurious TIME DOES NOT MATCH warning. Skip time delta validation while the buffer uses trace_clock_counter(). Clock selection already resets the buffer, so events recorded under a previous clock are not retained for this check. Recording and reading counter-clock events are unchanged. Link: https://lists.openwall.net/linux-kernel/2026/09/20/1283 Reported-by: syzbot+eb74dca0d1eb3ec227a7@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=eb74dca0d1eb3ec227a7 Signed-off-by: Kirtikumar Anandrao Ramchandani <kirtiar15502@gmail.com> --- Changes in v2: - Resend as plain text after the previous mail client reformatted the diff. kernel/trace/ring_buffer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 1fd28a7..c860d5b 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -4747,6 +4747,10 @@ static void check_buffer(struct ring_buffer_per_cpu *cpu_buffer, bool full = false; int ret; + /* The counter clock advances on every read, invalidating this check. */ + if (cpu_buffer->buffer->clock == trace_clock_counter) + return; + dpage = info->tail_page->page; if (tail == CHECK_FULL_PAGE) { base-commit: 05441d697f7f9a927264f4058cbbc6a03dfcac9d ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] ring-buffer: Skip time delta validation for the counter clock 2026-11-04 22:42 ` [PATCH v2] ring-buffer: Skip time delta validation for the counter clock Kirtikumar Anandrao Ramchandani @ 2026-11-05 14:07 ` Steven Rostedt 2026-11-05 14:19 ` [PATCH v3] " Kirtikumar Anandrao Ramchandani 1 sibling, 0 replies; 4+ messages in thread From: Steven Rostedt @ 2026-11-05 14:07 UTC (permalink / raw) To: Kirtikumar Anandrao Ramchandani Cc: mhiramat, mathieu.desnoyers, linux-trace-kernel, linux-kernel, syzkaller-bugs, syzbot+eb74dca0d1eb3ec227a7 On Wed, 4 Nov 2026 14:42:00 -0800 Kirtikumar Anandrao Ramchandani <kirtiar15502@gmail.com> wrote: > The counter trace clock increments on every read. Time delta validation > assumes that the clock values read while reserving and checking an event > can be reconciled with the deltas stored in the page. With the counter > clock, this assumption can fail for an intact ring buffer and report a > spurious TIME DOES NOT MATCH warning. > > Skip time delta validation while the buffer uses trace_clock_counter(). > Clock selection already resets the buffer, so events recorded under a > previous clock are not retained for this check. Recording and reading > counter-clock events are unchanged. > > Link: https://lists.openwall.net/linux-kernel/2026/09/20/1283 Nit, the above should be a lore link, but thanks for doing my todo ;-) -- Steve > Reported-by: syzbot+eb74dca0d1eb3ec227a7@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=eb74dca0d1eb3ec227a7 > Signed-off-by: Kirtikumar Anandrao Ramchandani <kirtiar15502@gmail.com> > --- ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v3] ring-buffer: Skip time delta validation for the counter clock 2026-11-04 22:42 ` [PATCH v2] ring-buffer: Skip time delta validation for the counter clock Kirtikumar Anandrao Ramchandani 2026-11-05 14:07 ` Steven Rostedt @ 2026-11-05 14:19 ` Kirtikumar Anandrao Ramchandani 2026-11-20 15:02 ` Steven Rostedt 1 sibling, 1 reply; 4+ messages in thread From: Kirtikumar Anandrao Ramchandani @ 2026-11-05 14:19 UTC (permalink / raw) To: Steven Rostedt, Masami Hiramatsu Cc: Mathieu Desnoyers, linux-trace-kernel, linux-kernel, syzkaller-bugs, syzbot+eb74dca0d1eb3ec227a7 The counter trace clock increments on every read. Time delta validation assumes that the clock values read while reserving and checking an event can be reconciled with the deltas stored in the page. With the counter clock, this assumption can fail for an intact ring buffer and report a spurious TIME DOES NOT MATCH warning. Skip time delta validation while the buffer uses trace_clock_counter(). Clock selection already resets the buffer, so events recorded under a previous clock are not retained for this check. Recording and reading counter-clock events are unchanged. Link: https://lore.kernel.org/all/20260920161648.7d9fda60@fedora/ Reported-by: syzbot+eb74dca0d1eb3ec227a7@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=eb74dca0d1eb3ec227a7 Signed-off-by: Kirtikumar Anandrao Ramchandani <kirtiar15502@gmail.com> --- Changes in v3: - Replace the Openwall archive URL with the corresponding lore link. Changes in v2: - Resend as plain text after the previous mail client reformatted the diff. kernel/trace/ring_buffer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 1fd28a7..c860d5b 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -4747,6 +4747,10 @@ static void check_buffer(struct ring_buffer_per_cpu *cpu_buffer, bool full = false; int ret; + /* The counter clock advances on every read, invalidating this check. */ + if (cpu_buffer->buffer->clock == trace_clock_counter) + return; + dpage = info->tail_page->page; if (tail == CHECK_FULL_PAGE) { base-commit: 05441d697f7f9a927264f4058cbbc6a03dfcac9d ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] ring-buffer: Skip time delta validation for the counter clock 2026-11-05 14:19 ` [PATCH v3] " Kirtikumar Anandrao Ramchandani @ 2026-11-20 15:02 ` Steven Rostedt 0 siblings, 0 replies; 4+ messages in thread From: Steven Rostedt @ 2026-11-20 15:02 UTC (permalink / raw) To: Kirtikumar Anandrao Ramchandani Cc: Masami Hiramatsu, Mathieu Desnoyers, linux-trace-kernel, linux-kernel, syzkaller-bugs, syzbot+eb74dca0d1eb3ec227a7 On Thu, 5 Nov 2026 06:19:54 -0800 Kirtikumar Anandrao Ramchandani <kirtiar15502@gmail.com> wrote: > The counter trace clock increments on every read. Time delta validation > assumes that the clock values read while reserving and checking an event > can be reconciled with the deltas stored in the page. With the counter > clock, this assumption can fail for an intact ring buffer and report a > spurious TIME DOES NOT MATCH warning. > > Skip time delta validation while the buffer uses trace_clock_counter(). > Clock selection already resets the buffer, so events recorded under a > previous clock are not retained for this check. Recording and reading > counter-clock events are unchanged. > > Link: https://lore.kernel.org/all/20260920161648.7d9fda60@fedora/ > Reported-by: syzbot+eb74dca0d1eb3ec227a7@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=eb74dca0d1eb3ec227a7 > Signed-off-by: Kirtikumar Anandrao Ramchandani <kirtiar15502@gmail.com> I'm going to hold off on applying this because I'm not fully convinced that this isn't hiding a real bug. I remember looking into this in the past and thinking I found the reason the counter breaks the check, but when looking at the code again, I'm not so sure. There may be a real bug here that only the counter can trigger. Or at least trigger more reliably. Until I'm sure there's not a real bug being hidden by this patch, I'm going to keep allowing this to trigger on the counter clock. Thanks, -- Steve ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-20 15:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CADZg-m04iG5kCZ5-yh=Vz_ysYjVDGSYn3je4_-8AzWWfiC-bXQ@mail.gmail.com>
2026-11-04 22:42 ` [PATCH v2] ring-buffer: Skip time delta validation for the counter clock Kirtikumar Anandrao Ramchandani
2026-11-05 14:07 ` Steven Rostedt
2026-11-05 14:19 ` [PATCH v3] " Kirtikumar Anandrao Ramchandani
2026-11-20 15:02 ` Steven Rostedt
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®