• Steven Rostedt (VMware)'s avatar
    tracing/fgraph: Fix set_graph_function from showing interrupts · 02cf6220
    Steven Rostedt (VMware) authored
    [ Upstream commit 5cf99a0f3161bc3ae2391269d134d6bf7e26f00e ]
    
    The tracefs file set_graph_function is used to only function graph functions
    that are listed in that file (or all functions if the file is empty). The
    way this is implemented is that the function graph tracer looks at every
    function, and if the current depth is zero and the function matches
    something in the file then it will trace that function. When other functions
    are called, the depth will be greater than zero (because the original
    function will be at depth zero), and all functions will be traced where the
    depth is greater than zero.
    
    The issue is that when a function is first entered, and the handler that
    checks this logic is called, the depth is set to zero. If an interrupt comes
    in and a function in the interrupt handler is traced, its depth will be
    greater than zero and it will automatically be traced, even if the original
    function was not. But because the logic only looks at depth it may trace
    interrupts when it should not be.
    
    The recent design change of the function graph tracer to fix other bugs
    caused the depth to be zero while the function graph callback handler is
    being called for a longer time, widening the race of this happening. This
    bug was actually there for a longer time, but because the race window was so
    small it seldom happened. The Fixes tag below is for the commit that widen
    the race window, because that commit belongs to a series that will also help
    fix the original bug.
    
    Cc: stable@kernel.org
    Fixes: 39eb456dacb5 ("function_graph: Use new curr_ret_depth to manage depth instead of curr_ret_stack")
    Reported-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
    Tested-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
    Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
    Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
    02cf6220
Name
Last commit
Last update
..
Kconfig Loading commit data...
Makefile Loading commit data...
blktrace.c Loading commit data...
bpf_trace.c Loading commit data...
ftrace.c Loading commit data...
power-traces.c Loading commit data...
ring_buffer.c Loading commit data...
ring_buffer_benchmark.c Loading commit data...
rpm-traces.c Loading commit data...
trace.c Loading commit data...
trace.h Loading commit data...
trace_benchmark.c Loading commit data...
trace_benchmark.h Loading commit data...
trace_branch.c Loading commit data...
trace_clock.c Loading commit data...
trace_entries.h Loading commit data...
trace_event_perf.c Loading commit data...
trace_events.c Loading commit data...
trace_events_filter.c Loading commit data...
trace_events_filter_test.h Loading commit data...
trace_events_hist.c Loading commit data...
trace_events_trigger.c Loading commit data...
trace_export.c Loading commit data...
trace_functions.c Loading commit data...
trace_functions_graph.c Loading commit data...
trace_hwlat.c Loading commit data...
trace_irqsoff.c Loading commit data...
trace_kdb.c Loading commit data...
trace_kprobe.c Loading commit data...
trace_mmiotrace.c Loading commit data...
trace_nop.c Loading commit data...
trace_output.c Loading commit data...
trace_output.h Loading commit data...
trace_printk.c Loading commit data...
trace_probe.c Loading commit data...
trace_probe.h Loading commit data...
trace_sched_switch.c Loading commit data...
trace_sched_wakeup.c Loading commit data...
trace_selftest.c Loading commit data...
trace_selftest_dynamic.c Loading commit data...
trace_seq.c Loading commit data...
trace_stack.c Loading commit data...
trace_stat.c Loading commit data...
trace_stat.h Loading commit data...
trace_syscalls.c Loading commit data...
trace_uprobe.c Loading commit data...
tracing_map.c Loading commit data...
tracing_map.h Loading commit data...