]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ring-buffer: Fix recursion protection transitions between interrupt context
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Mon, 2 Nov 2020 20:31:27 +0000 (15:31 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Nov 2020 11:35:58 +0000 (12:35 +0100)
commitb410d07e965a039dc67073889dab9ff01cee8402
tree6ee85fb09c90147326aeccdc293e20b4c4401251
parentfe0af0efa7b1ecb8aebb5e8f44d00db07f564c6c
ring-buffer: Fix recursion protection transitions between interrupt context

commit b02414c8f045ab3b9afc816c3735bc98c5c3d262 upstream.

The recursion protection of the ring buffer depends on preempt_count() to be
correct. But it is possible that the ring buffer gets called after an
interrupt comes in but before it updates the preempt_count(). This will
trigger a false positive in the recursion code.

Use the same trick from the ftrace function callback recursion code which
uses a "transition" bit that gets set, to allow for a single recursion for
to handle transitions between contexts.

Cc: stable@vger.kernel.org
Fixes: 567cd4da54ff4 ("ring-buffer: User context bit recursion checking")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/ring_buffer.c