Steven Rostedt (Red Hat)
8e2e2fa471
tracing: Add trace_array_get/put() to event handling
...
Commit a695cb5816 "tracing: Prevent deleting instances when they are being read"
tried to fix a race between deleting a trace instance and reading contents
of a trace file. But it wasn't good enough. The following could crash the kernel:
# cd /sys/kernel/debug/tracing/instances
# ( while :; do mkdir foo; rmdir foo; done ) &
# ( while :; do echo 1 > foo/events/sched/sched_switch 2> /dev/null; done ) &
Luckily this can only be done by root user, but it should be fixed regardless.
The problem is that a delete of the file can happen after the write to the event
is opened, but before the enabling happens.
The solution is to make sure the trace_array is available before succeeding in
opening for write, and incerment the ref counter while opened.
Now the instance can be deleted when the events are writing to the buffer,
but the deletion of the instance will disable all events before the instance
is actually deleted.
Cc: stable@vger.kernel.org # 3.10
Reported-by: Alexander Lam <azl@google.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2013-07-02 17:13:34 -04:00
..
blktrace.c
Merge branch 'for-3.10/drivers' of git://git.kernel.dk/linux-block
2013-05-08 11:51:05 -07:00
ftrace.c
ftrace: Do not run selftest if command line parameter is set
2013-07-01 20:57:15 -04:00
Kconfig
ring-buffer: Select IRQ_WORK
2013-05-03 19:24:17 -04:00
Makefile
trace: Stop compiling in trace_clock unconditionally
2012-09-13 22:52:08 -04:00
power-traces.c
PM / tracing: remove deprecated power trace API
2013-01-26 00:39:12 +01:00
ring_buffer.c
ring-buffer: Do not poll non allocated cpu buffers
2013-05-28 10:53:20 -04:00
ring_buffer_benchmark.c
rpm-traces.c
trace.c
tracing: Get trace_array ref counts when accessing trace files
2013-07-02 10:17:04 -04:00
trace.h
tracing: Add trace_array_get/put() to event handling
2013-07-02 17:13:34 -04:00
trace_branch.c
tracing: Fix the branch tracer that broke with buffer change
2013-03-15 00:35:54 -04:00
trace_clock.c
tracing: Add "uptime" trace clock that uses jiffies
2013-03-15 00:36:09 -04:00
trace_entries.h
tracing: Add trace_puts() for even faster trace_printk() tracing
2013-03-15 00:35:55 -04:00
trace_event_perf.c
perf/core improvements and fixes:
2012-08-21 11:27:00 +02:00
trace_events.c
tracing: Add trace_array_get/put() to event handling
2013-07-02 17:13:34 -04:00
trace_events_filter.c
tracing: Add binary '&' filter for events
2013-06-19 23:30:40 -04:00
trace_events_filter_test.h
trace_export.c
tracing: Fix some section mismatch warnings
2013-03-15 00:34:54 -04:00
trace_functions.c
tracing: Add function probe to trigger a ftrace dump of current CPU trace
2013-06-11 18:38:48 -04:00
trace_functions_graph.c
tracing: Consolidate max_tr into main trace_array structure
2013-03-15 00:35:40 -04:00
trace_irqsoff.c
tracing: Use flag buffer_disabled for irqsoff tracer
2013-07-01 20:34:28 -04:00
trace_kdb.c
tracing: Consolidate max_tr into main trace_array structure
2013-03-15 00:35:40 -04:00
trace_kprobe.c
tracing/kprobes: Don't pass addr=ip to perf_trace_buf_submit()
2013-07-01 20:34:28 -04:00
trace_mmiotrace.c
tracing: Consolidate max_tr into main trace_array structure
2013-03-15 00:35:40 -04:00
trace_nop.c
trace_output.c
Tracing updates for Linux 3.10
2013-04-29 13:55:38 -07:00
trace_output.h
tracing: Rename trace_event_mutex to trace_event_sem
2013-03-15 13:22:10 -04:00
trace_printk.c
tracing: Add percpu buffers for trace_printk()
2012-04-23 21:15:55 -04:00
trace_probe.c
tracing: Replace strict_strto* with kstrto*
2012-10-31 16:45:23 -04:00
trace_probe.h
uprobes/tracing: Introduce is_trace_uprobe_enabled()
2013-02-08 18:24:30 +01:00
trace_sched_switch.c
tracing: Consolidate max_tr into main trace_array structure
2013-03-15 00:35:40 -04:00
trace_sched_wakeup.c
tracing: Add function-trace option to disable function tracing of latency tracers
2013-03-15 00:36:08 -04:00
trace_selftest.c
ftrace: Do not run selftest if command line parameter is set
2013-07-01 20:57:15 -04:00
trace_selftest_dynamic.c
trace_stack.c
Tracing updates for Linux 3.10
2013-04-29 13:55:38 -07:00
trace_stat.c
tracing: Check return value of tracing_init_dentry()
2013-04-12 23:02:32 -04:00
trace_stat.h
trace_syscalls.c
tracing: Fix comment about prefix in arch_syscall_match_sym_name()
2013-03-15 13:22:09 -04:00
trace_uprobe.c
uprobes/perf: Avoid perf_trace_buf_prepare/submit if ->perf_events is empty
2013-04-15 17:39:52 +02:00