lkml.org 
[lkml]   [2010]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[017/116] function-graph: Init curr_ret_stack with ret_stack
    2.6.32-stable review patch.  If anyone has any objections, please let us know.

    ------------------

    From: Steven Rostedt <srostedt@redhat.com>

    commit ea14eb714041d40fcc5180b5a586034503650149 upstream.

    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.

    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

    ---
    kernel/trace/ftrace.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/kernel/trace/ftrace.c
    +++ b/kernel/trace/ftrace.c
    @@ -3258,6 +3258,7 @@ void ftrace_graph_init_task(struct task_
    {
    /* 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;
    @@ -3267,7 +3268,6 @@ void ftrace_graph_init_task(struct task_
    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;



    \
     
     \ /
      Last update: 2010-03-31 01:21    [W:5.566 / U:0.232 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site