]> git.baikalelectronics.ru Git - kernel.git/commit
ftrace: Check for null ret_stack on profile function graph entry function
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Thu, 17 Aug 2017 20:37:25 +0000 (16:37 -0400)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Thu, 24 Aug 2017 14:04:01 +0000 (10:04 -0400)
commit63d117daa73b17238c82b7cd1be97fc72d48068e
treed01ffa943d7a2382bdd50255a4949fa696737b66
parentc93db978f339fdddf26633f4ec35ebfc1adadf23
ftrace: Check for null ret_stack on profile function graph entry function

There's a small race when function graph shutsdown and the calling of the
registered function graph entry callback. The callback must not reference
the task's ret_stack without first checking that it is not NULL. Note, when
a ret_stack is allocated for a task, it stays allocated until the task exits.
The problem here, is that function_graph is shutdown, and a new task was
created, which doesn't have its ret_stack allocated. But since some of the
functions are still being traced, the callbacks can still be called.

The normal function_graph code handles this, but starting with commit
40c664838d ("ftrace: Access ret_stack->subtime only in the function
profiler") the profiler code references the ret_stack on function entry, but
doesn't check if it is NULL first.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=196611
Cc: stable@vger.kernel.org
Fixes: 40c664838d ("ftrace: Access ret_stack->subtime only in the function profiler")
Reported-by: lilydjwg@gmail.com
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/ftrace.c