public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>, Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 06/10] function-graph: add proper initialization for init task
Date: Mon, 06 Apr 2009 12:37:12 -0400	[thread overview]
Message-ID: <20090406163830.968014635@goodmis.org> (raw)
In-Reply-To: 20090406163706.097842409@goodmis.org

[-- Attachment #1: 0006-function-graph-add-proper-initialization-for-init-t.patch --]
[-- Type: text/plain, Size: 2474 bytes --]

From: Steven Rostedt <rostedt@goodmis.org>

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>
---
 include/linux/ftrace.h    |    8 ++++++--
 include/linux/init_task.h |    2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 9e0a8d2..6aea54d 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -356,6 +356,9 @@ struct ftrace_graph_ret {
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 
+/* for init task */
+#define INIT_FTRACE_GRAPH		.ret_stack = NULL
+
 /*
  * Stack of return addresses for functions
  * of a thread.
@@ -429,10 +432,11 @@ static inline void unpause_graph_tracing(void)
 {
 	atomic_dec(&current->tracing_graph_pause);
 }
-#else
+#else /* !CONFIG_FUNCTION_GRAPH_TRACER */
 
 #define __notrace_funcgraph
 #define __irq_entry
+#define INIT_FTRACE_GRAPH
 
 static inline void ftrace_graph_init_task(struct task_struct *t) { }
 static inline void ftrace_graph_exit_task(struct task_struct *t) { }
@@ -444,7 +448,7 @@ static inline int task_curr_ret_stack(struct task_struct *tsk)
 
 static inline void pause_graph_tracing(void) { }
 static inline void unpause_graph_tracing(void) { }
-#endif
+#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
 
 #ifdef CONFIG_TRACING
 #include <linux/sched.h>
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index af1de95..dcfb933 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -5,6 +5,7 @@
 #include <linux/irqflags.h>
 #include <linux/utsname.h>
 #include <linux/lockdep.h>
+#include <linux/ftrace.h>
 #include <linux/ipc.h>
 #include <linux/pid_namespace.h>
 #include <linux/user_namespace.h>
@@ -185,6 +186,7 @@ extern struct cred init_cred;
 	INIT_IDS							\
 	INIT_TRACE_IRQFLAGS						\
 	INIT_LOCKDEP							\
+	INIT_FTRACE_GRAPH						\
 }
 
 
-- 
1.6.2.1

-- 

  parent reply	other threads:[~2009-04-06 16:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-06 16:37 [PATCH 00/10] [GIT PULL] for tip/tracing/core Steven Rostedt
2009-04-06 16:37 ` [PATCH 01/10] tracing: remove CALLER_ADDR2 from wakeup tracer Steven Rostedt
2009-04-06 16:37 ` [PATCH 02/10] tracing: use macros to denote usec and nsec per second Steven Rostedt
2009-04-06 16:37 ` [PATCH 03/10] tracing: fix incorrect return type of ns2usecs() V2 Steven Rostedt
2009-04-06 16:37 ` [PATCH 04/10] tracing/ftrace: fix missing include string.h Steven Rostedt
2009-04-06 16:37 ` [PATCH 05/10] tracing/ftrace: factorize the tracing files creation Steven Rostedt
2009-04-07 12:23   ` Ingo Molnar
2009-04-07 19:19     ` Steven Rostedt
2009-04-06 16:37 ` Steven Rostedt [this message]
2009-04-06 16:37 ` [PATCH 07/10] function-graph: use int instead of atomic for ftrace_graph_active Steven Rostedt
2009-04-06 16:37 ` [PATCH 08/10] ftrace: Add check of sched_stopped for probe_sched_wakeup Steven Rostedt
2009-04-06 16:37 ` [PATCH 09/10] ftrace: Clean up enable logic for sched_switch Steven Rostedt
2009-04-06 16:37 ` [PATCH 10/10] tracing, x86: remove duplicated #include Steven Rostedt
2009-04-07 11:56 ` [PATCH 00/10] [GIT PULL] for tip/tracing/core Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2009-04-04  0:27 [PATCH 00/10] [GIT PULL] updates for tip/tracing/ftrace Steven Rostedt
2009-04-04  0:27 ` [PATCH 06/10] function-graph: add proper initialization for init task Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090406163830.968014635@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox