]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ring-buffer: Always check to put back before stamp when crossing pages
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 1 Dec 2020 04:16:03 +0000 (23:16 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Dec 2020 12:22:06 +0000 (13:22 +0100)
commit5b158d047fe6b7f3ccca36fc077ea653da527dca
treebf371f917f94f7911fad46e6213f439a28b60ab8
parent68e17e0b384c1cf6355591fcc2d1be003fc31a86
ring-buffer: Always check to put back before stamp when crossing pages

commit 68e10d5ff512b503dcba1246ad5620f32035e135 upstream.

The current ring buffer logic checks to see if the updating of the event
buffer was interrupted, and if it is, it will try to fix up the before stamp
with the write stamp to make them equal again. This logic is flawed, because
if it is not interrupted, the two are guaranteed to be different, as the
current event just updated the before stamp before allocation. This
guarantees that the next event (this one or another interrupting one) will
think it interrupted the time updates of a previous event and inject an
absolute time stamp to compensate.

The correct logic is to always update the timestamps when traversing to a
new sub buffer.

Cc: stable@vger.kernel.org
Fixes: a389d86f7fd09 ("ring-buffer: Have nested events still record running time stamp")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/ring_buffer.c