linux-stable/kernel/trace
Steven Rostedt (VMware) c9e38a3cc4 tracing: Use trace_sched_process_free() instead of exit() for pid tracing
commit afcab63665 upstream.

On exit, if a process is preempted after the trace_sched_process_exit()
tracepoint but before the process is done exiting, then when it gets
scheduled in, the function tracers will not filter it properly against the
function tracing pid filters.

That is because the function tracing pid filters hooks to the
sched_process_exit() tracepoint to remove the exiting task's pid from the
filter list. Because the filtering happens at the sched_switch tracepoint,
when the exiting task schedules back in to finish up the exit, it will no
longer be in the function pid filtering tables.

This was noticeable in the notrace self tests on a preemptable kernel, as
the tests would fail as it exits and preempted after being taken off the
notrace filter table and on scheduling back in it would not be in the
notrace list, and then the ending of the exit function would trace. The test
detected this and would fail.

Cc: stable@vger.kernel.org
Cc: Namhyung Kim <namhyung@kernel.org>
Fixes: 1e10486ffe ("ftrace: Add 'function-fork' trace option")
Fixes: c37775d578 ("tracing: Add infrastructure to allow set_event_pid to follow children"
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-08-21 09:48:19 +02:00
..
blktrace.c blktrace: break out of blktrace setup on concurrent calls 2020-06-30 15:38:06 -04:00
bpf_trace.c bpf: fix check of allowed specifiers in bpf_trace_printk 2018-12-17 09:28:50 +01:00
ftrace.c tracing: Use trace_sched_process_free() instead of exit() for pid tracing 2020-08-21 09:48:19 +02:00
Kconfig Stop the ad-hoc games with -Wno-maybe-initialized 2020-05-20 08:17:10 +02:00
Makefile
power-traces.c
ring_buffer.c trace: Fix preempt_enable_no_resched() abuse 2019-05-02 09:40:28 +02:00
ring_buffer_benchmark.c
rpm-traces.c
trace.c tracing: Add a vmalloc_sync_mappings() for safe measure 2020-05-20 08:16:58 +02:00
trace.h ftrace: Protect ftrace_graph_hash with ftrace_sync 2020-02-14 16:32:13 -05:00
trace_benchmark.c
trace_benchmark.h
trace_branch.c Revert "x86/uaccess, ftrace: Fix ftrace_likely_update() vs. SMAP" 2019-07-03 13:15:57 +02:00
trace_clock.c
trace_entries.h tracing: Fix missing tab for hwlat_detector print format 2018-04-29 11:33:17 +02:00
trace_event_perf.c
trace_events.c tracing: Use trace_sched_process_free() instead of exit() for pid tracing 2020-08-21 09:48:19 +02:00
trace_events_filter.c tracing: Fix regex_match_front() to not over compare the test string 2018-05-16 10:10:27 +02:00
trace_events_filter_test.h
trace_events_hist.c tracing: Use strncpy instead of memcpy for string keys in hist triggers 2019-03-23 14:35:19 +01:00
trace_events_trigger.c tracing: Fix event trigger to accept redundant spaces 2020-06-30 15:38:08 -04:00
trace_export.c
trace_functions.c
trace_functions_graph.c tracing/fgraph: Fix set_graph_function from showing interrupts 2019-05-16 19:42:27 +02:00
trace_hwlat.c tracing/hwlat: Honor the tracing_cpumask 2020-08-21 09:48:19 +02:00
trace_irqsoff.c tracing/fgraph: Fix set_graph_function from showing interrupts 2019-05-16 19:42:27 +02:00
trace_kdb.c tracing: Silence GCC 9 array bounds warning 2019-06-25 11:36:50 +08:00
trace_kprobe.c ftrace/kprobe: Show the maxactive number on kprobe_events 2020-04-24 08:00:50 +02:00
trace_mmiotrace.c
trace_nop.c
trace_output.c tracing: Reorder display of TGID to be after PID 2018-07-17 11:39:30 +02:00
trace_output.h
trace_printk.c
trace_probe.c
trace_probe.h
trace_sched_switch.c tracing: Fix sched switch start/stop refcount racy updates 2020-02-14 16:32:07 -05:00
trace_sched_wakeup.c kernel/trace: Fix do not unregister tracepoints when register sched_migrate_task fail 2020-01-14 20:05:40 +01:00
trace_selftest.c
trace_selftest_dynamic.c
trace_seq.c
trace_stack.c tracing: Have stack tracer compile when MCOUNT_INSN_SIZE is not defined 2020-01-14 20:05:40 +01:00
trace_stat.c tracing: Fix very unlikely race of registering two stat tracers 2020-02-28 16:35:58 +01:00
trace_stat.h
trace_syscalls.c
trace_uprobe.c tracing/uprobes: Fix output for multiple string arguments 2019-02-20 10:20:53 +01:00
tracing_map.c tracing: Have the histogram compare functions convert to u64 first 2020-01-09 10:17:56 +01:00
tracing_map.h