[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100314100959.GA5140@nowhere>
Date: Sun, 14 Mar 2010 11:10:01 +0100
From: Frederic Weisbecker <fweisbec@...il.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>,
Li Zefan <lizf@...fujitsu.com>,
Lai Jiangshan <laijs@...fujitsu.com>, stable@...nel.org
Subject: Re: [PATCH 2/5] function-graph: Init curr_ret_stack with ret_stack
On Fri, Mar 12, 2010 at 09:56:57PM -0500, Steven Rostedt wrote:
> From: Steven Rostedt <srostedt@...hat.com>
>
> If the graph tracer is active, and a task is forked but the allocating of
> the processes graph stack fails, it can cause crash later on.
>
> This is due to the temporary stack being NULL, but the curr_ret_stack
> variable is copied from the parent. If it is not -1, then in
> ftrace_graph_probe_sched_switch() the following:
>
> for (index = next->curr_ret_stack; index >= 0; index--)
> next->ret_stack[index].calltime += timestamp;
>
> Will cause a kernel OOPS.
>
> Found with Li Zefan's ftrace_stress_test.
>
> Cc: stable@...nel.org
> Signed-off-by: Steven Rostedt <rostedt@...dmis.org>
Ah, well spotted!
> ---
> kernel/trace/ftrace.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index d4d1238..bb53edb 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -3349,6 +3349,7 @@ void ftrace_graph_init_task(struct task_struct *t)
> {
> /* Make sure we do not use the parent ret_stack */
> t->ret_stack = NULL;
> + t->curr_ret_stack = -1;
>
> if (ftrace_graph_active) {
> struct ftrace_ret_stack *ret_stack;
> @@ -3358,7 +3359,6 @@ void ftrace_graph_init_task(struct task_struct *t)
> GFP_KERNEL);
> if (!ret_stack)
> return;
> - t->curr_ret_stack = -1;
> atomic_set(&t->tracing_graph_pause, 0);
> atomic_set(&t->trace_overrun, 0);
> t->ftrace_timestamp = 0;
> --
> 1.7.0
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists