aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2009-03-25 20:55:00 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-07 08:00:39 -0400
commit5ac9f62267dc92c7735c642a5942d9e6c1190308 (patch)
treeb426f4c02384d9454ee91ca7d5ab8a495bc679d0
parent5f0c6c03c5fee91c02c696bc9bf4c0d41392abe7 (diff)
function-graph: add proper initialization for init task
Impact: fix to crash going to kexec The init task did not properly initialize the function graph pointers. Altough these pointers are NULL, they can not be assumed to be NULL for the init task, and must still be properly initialize. This usually is not an issue since a problem only arises when a task exits, and the init tasks do not usually exit. But when doing tests with kexec, the init tasks do exit, and the bug appears. This patch properly initializes the init tasks function graph data structures. Reported-and-Tested-by: Yinghai Lu <yinghai@kernel.org> LKML-Reference: <alpine.DEB.2.00.0903252053080.5675@gandalf.stny.rr.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--include/linux/ftrace.h8
-rw-r--r--include/linux/init_task.h2
2 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 015a3d22cf74..da5405dce347 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -356,6 +356,9 @@ struct ftrace_graph_ret {
356 356
357#ifdef CONFIG_FUNCTION_GRAPH_TRACER 357#ifdef CONFIG_FUNCTION_GRAPH_TRACER
358 358
359/* for init task */
360#define INIT_FTRACE_GRAPH .ret_stack = NULL
361
359/* 362/*
360 * Stack of return addresses for functions 363 * Stack of return addresses for functions
361 * of a thread. 364 * of a thread.
@@ -430,10 +433,11 @@ static inline void unpause_graph_tracing(void)
430{ 433{
431 atomic_dec(&current->tracing_graph_pause); 434 atomic_dec(&current->tracing_graph_pause);
432} 435}
433#else 436#else /* !CONFIG_FUNCTION_GRAPH_TRACER */
434 437
435#define __notrace_funcgraph 438#define __notrace_funcgraph
436#define __irq_entry 439#define __irq_entry
440#define INIT_FTRACE_GRAPH
437 441
438static inline void ftrace_graph_init_task(struct task_struct *t) { } 442static inline void ftrace_graph_init_task(struct task_struct *t) { }
439static inline void ftrace_graph_exit_task(struct task_struct *t) { } 443static inline void ftrace_graph_exit_task(struct task_struct *t) { }
@@ -445,7 +449,7 @@ static inline int task_curr_ret_stack(struct task_struct *tsk)
445 449
446static inline void pause_graph_tracing(void) { } 450static inline void pause_graph_tracing(void) { }
447static inline void unpause_graph_tracing(void) { } 451static inline void unpause_graph_tracing(void) { }
448#endif 452#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
449 453
450#ifdef CONFIG_TRACING 454#ifdef CONFIG_TRACING
451#include <linux/sched.h> 455#include <linux/sched.h>
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index e752d973fa21..cada05447bc8 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -5,6 +5,7 @@
5#include <linux/irqflags.h> 5#include <linux/irqflags.h>
6#include <linux/utsname.h> 6#include <linux/utsname.h>
7#include <linux/lockdep.h> 7#include <linux/lockdep.h>
8#include <linux/ftrace.h>
8#include <linux/ipc.h> 9#include <linux/ipc.h>
9#include <linux/pid_namespace.h> 10#include <linux/pid_namespace.h>
10#include <linux/user_namespace.h> 11#include <linux/user_namespace.h>
@@ -184,6 +185,7 @@ extern struct cred init_cred;
184 INIT_IDS \ 185 INIT_IDS \
185 INIT_TRACE_IRQFLAGS \ 186 INIT_TRACE_IRQFLAGS \
186 INIT_LOCKDEP \ 187 INIT_LOCKDEP \
188 INIT_FTRACE_GRAPH \
187} 189}
188 190
189 191