public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing: Fix infinite loop in ftrace_update_pid_func()
@ 2009-09-28 15:43 Matt Fleming
  2009-09-29  9:22 ` Frederic Weisbecker
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Matt Fleming @ 2009-09-28 15:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Steven Rostedt, Frederic Weisbecker, Ingo Molnar

From: Matt Fleming <matthew.fleming@imgtec.com>

When CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST is enabled
__ftrace_trace_function contains the current trace function, not
ftrace_trace_function. In ftrace_update_pid_func() we currently
incorrectly assign the value of ftrace_trace_function to
__ftrace_trace_funcion before returning.

Without this patch it is possible to execute an infinite loop whereby
ftrace_test_stop_func() calls __ftrace_trace_function, which was
assigned ftrace_test_stop_func() in ftrace_update_pid_func().

Signed-off-by: Matt Fleming <matthew.fleming@imgtec.com>
---
 kernel/trace/ftrace.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 25edd5c..d9ba6d9 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -225,7 +225,11 @@ static void ftrace_update_pid_func(void)
 	if (ftrace_trace_function == ftrace_stub)
 		return;
 
+#ifdef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	func = ftrace_trace_function;
+#else
+	func = __ftrace_trace_function;
+#endif
 
 	if (ftrace_pid_trace) {
 		set_ftrace_pid_function(func);
-- 
1.6.3.GIT


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-10-01  6:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-28 15:43 [PATCH] tracing: Fix infinite loop in ftrace_update_pid_func() Matt Fleming
2009-09-29  9:22 ` Frederic Weisbecker
2009-09-29  9:44   ` Matt Fleming
2009-09-30  8:41   ` Steven Rostedt
2009-09-30  8:51     ` Matt Fleming
2009-09-29  9:51 ` Matt Fleming
2009-10-01  6:48 ` [tip:tracing/urgent] tracing: Fix infinite recursion " tip-bot for Matt Fleming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox