diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2016-12-09 02:54:49 +0100 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2016-12-09 15:19:28 +0100 |
commit | 794de08a16cf1fc1bf785dc48f66d36218cf6d88 (patch) | |
tree | b9dc42593b6082fc5cafb61629f723076929e45e /fs/xfs/xfs_mount.c | |
parent | tracing: Replace kmap with copy_from_user() in trace_marker writing (diff) | |
download | linux-794de08a16cf1fc1bf785dc48f66d36218cf6d88.tar.xz linux-794de08a16cf1fc1bf785dc48f66d36218cf6d88.zip |
fgraph: Handle a case where a tracer ignores set_graph_notrace
Both the wakeup and irqsoff tracers can use the function graph tracer when
the display-graph option is set. The problem is that they ignore the notrace
file, and record the entry of functions that would be ignored by the
function_graph tracer. This causes the trace->depth to be recorded into the
ring buffer. The set_graph_notrace uses a trick by adding a large negative
number to the trace->depth when a graph function is to be ignored.
On trace output, the graph function uses the depth to record a stack of
functions. But since the depth is negative, it accesses the array with a
negative number and causes an out of bounds access that can cause a kernel
oops or corrupt data.
Have the print functions handle cases where a tracer still records functions
even when they are in set_graph_notrace.
Also add warnings if the depth is below zero before accessing the array.
Note, the function graph logic will still prevent the return of these
functions from being recorded, which means that they will be left hanging
without a return. For example:
# echo '*spin*' > set_graph_notrace
# echo 1 > options/display-graph
# echo wakeup > current_tracer
# cat trace
[...]
_raw_spin_lock() {
preempt_count_add() {
do_raw_spin_lock() {
update_rq_clock();
Where it should look like:
_raw_spin_lock() {
preempt_count_add();
do_raw_spin_lock();
}
update_rq_clock();
Cc: stable@vger.kernel.org
Cc: Namhyung Kim <namhyung.kim@lge.com>
Fixes: 29ad23b00474 ("ftrace: Add set_graph_notrace filter")
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'fs/xfs/xfs_mount.c')
0 files changed, 0 insertions, 0 deletions