浏览代码

ftrace: Fix function tracing recursion self test

The function tracing recursion self test should not crash
the machine if the resursion test fails. If it detects that
the function tracing is recursing when it should not be, then
bail, don't go into an infinite recursive loop.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Steven Rostedt 13 年之前
父节点
当前提交
9640388b63
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      kernel/trace/trace_selftest.c

+ 2 - 1
kernel/trace/trace_selftest.c

@@ -415,7 +415,8 @@ static void trace_selftest_test_recursion_func(unsigned long ip,
 	 * The ftrace infrastructure should provide the recursion
 	 * The ftrace infrastructure should provide the recursion
 	 * protection. If not, this will crash the kernel!
 	 * protection. If not, this will crash the kernel!
 	 */
 	 */
-	trace_selftest_recursion_cnt++;
+	if (trace_selftest_recursion_cnt++ > 10)
+		return;
 	DYN_FTRACE_TEST_NAME();
 	DYN_FTRACE_TEST_NAME();
 }
 }