]> git.baikalelectronics.ru Git - kernel.git/commit
function-graph: Init curr_ret_stack with ret_stack
authorSteven Rostedt <srostedt@redhat.com>
Sat, 13 Mar 2010 00:41:23 +0000 (19:41 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Sat, 13 Mar 2010 01:28:02 +0000 (20:28 -0500)
commit94286e2cc60b95fd5d08562e6a79f61071d89cad
treea7cb72753c85cf79ac6fa31863d65d2f081e0823
parentaa61afbdb24efe25d4ef25699656e45afd684742
function-graph: Init curr_ret_stack with ret_stack

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@kernel.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/ftrace.c