Skip to content

Commit ee11b93

Browse files
committed
ftrace: Fix recursion check for NMI test
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: edc15ca ("tracing: Avoid unnecessary multiple recursion checks") Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent c1acb4a commit ee11b93

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎kernel/trace/trace.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ static __always_inline int trace_test_and_set_recursion(int start, int max)
698698
current->trace_recursion = val;
699699
barrier();
700700

701-
return bit;
701+
return bit + 1;
702702
}
703703

704704
static __always_inline void trace_clear_recursion(int bit)
@@ -708,6 +708,7 @@ static __always_inline void trace_clear_recursion(int bit)
708708
if (!bit)
709709
return;
710710

711+
bit--;
711712
bit = 1 << bit;
712713
val &= ~bit;
713714

0 commit comments

Comments
 (0)