]> git.ipfire.org Git - people/arne_f/kernel.git/commit
ftrace: Fix recursion check for NMI test
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Thu, 29 Oct 2020 21:31:45 +0000 (17:31 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Nov 2020 09:29:04 +0000 (10:29 +0100)
commitab3e3ca5445902c7e0bbac2848e2f885d3e0d8b7
tree2264498dd534321b850eae589e65f579ac6ba12b
parent93372bf8418d2da6b2c607da9d62deff7dfebd3a
ftrace: Fix recursion check for NMI test

commit ee11b93f95eabdf8198edd4668bf9102e7248270 upstream.

The code that checks recursion will work to only do the recursion check once
if there's nested checks. The top one will do the check, the other nested
checks will see recursion was already checked and return zero for its "bit".
On the return side, nothing will be done if the "bit" is zero.

The problem is that zero is returned for the "good" bit when in NMI context.
This will set the bit for NMIs making it look like *all* NMI tracing is
recursing, and prevent tracing of anything in NMI context!

The simple fix is to return "bit + 1" and subtract that bit on the end to
get the real bit.

Cc: stable@vger.kernel.org
Fixes: edc15cafcbfa3 ("tracing: Avoid unnecessary multiple recursion checks")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/trace.h