linux/kernel/trace
Li Zefan 00e95830a4 tracing/filters: fix race between filter setting and module unload
Module unload is protected by event_mutex, while setting filter is
protected by filter_mutex. This leads to the race:

echo 'bar == 0 || bar == 10' \    |
		> sample/filter   |
                                  |  insmod sample.ko
  add_pred("bar == 0")            |
    -> n_preds == 1               |
  add_pred("bar == 100")          |
    -> n_preds == 2               |
                                  |  rmmod sample.ko
                                  |  insmod sample.ko
  add_pred("&&")                  |
    -> n_preds == 1 (should be 3) |

Now event->filter->preds is corrupted. An then when filter_match_preds()
is called, the WARN_ON() in it will be triggered.

To avoid the race, we remove filter_mutex, and replace it with event_mutex.

[ Impact: prevent corruption of filters by module removing and loading ]

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4A375A4D.6000205@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2009-06-16 16:25:37 -04:00
..
blktrace.c Merge branch 'for-2.6.31' of git://git.kernel.dk/linux-2.6-block 2009-06-11 11:10:35 -07:00
ftrace.c Merge branch 'tracing-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-06-10 19:58:10 -07:00
Kconfig tracing: combine the default tracers into one config 2009-06-01 23:23:55 -04:00
kmemtrace.c cpumask: use new operators in kernel/trace 2009-06-15 11:36:42 -04:00
Makefile tracing/events: convert block trace points to TRACE_EVENT() 2009-06-09 12:34:23 -04:00
ring_buffer_benchmark.c ring-buffer: have benchmark test handle discarded events 2009-06-16 13:48:52 -04:00
ring_buffer.c ring-buffer: use commit counters for commit pointer accounting 2009-06-16 16:25:33 -04:00
trace_boot.c tracing: use macros to denote usec and nsec per second 2009-04-07 14:43:06 +02:00
trace_branch.c Merge branch 'linus' into tracing/core 2009-05-07 11:17:34 +02:00
trace_clock.c tracing: fix four sparse warnings 2009-03-22 18:16:54 +01:00
trace_event_profile.c tracing/events: fix concurrent access to ftrace_events list 2009-05-06 10:38:19 +02:00
trace_event_types.h tracing/filters: distinguish between signed and unsigned fields 2009-04-29 14:06:03 +02:00
trace_events_filter.c tracing/filters: fix race between filter setting and module unload 2009-06-16 16:25:37 -04:00
trace_events.c tracing: add protection around module events unload 2009-06-09 17:29:07 -04:00
trace_export.c tracing/filters: distinguish between signed and unsigned fields 2009-04-29 14:06:03 +02:00
trace_functions_graph.c Merge branch 'tracing-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-06-10 19:58:10 -07:00
trace_functions.c tracing/core: use appropriate waiting on trace_pipe 2009-02-18 01:40:20 +01:00
trace_hw_branches.c Merge branch 'tracing/hw-branch-tracing' into tracing/core 2009-05-07 13:36:22 +02:00
trace_irqsoff.c tracing: have latency tracers set the latency format 2009-03-04 22:15:30 -05:00
trace_mmiotrace.c tracing: use macros to denote usec and nsec per second 2009-04-07 14:43:06 +02:00
trace_nop.c tracing/ftrace: make nop-tracer use polling wait for events on pipe 2009-03-23 09:22:15 +01:00
trace_output.c tracing: add protection around module events unload 2009-06-09 17:29:07 -04:00
trace_output.h tracing: add protection around module events unload 2009-06-09 17:29:07 -04:00
trace_power.c Merge branch 'linus' into tracing/core 2009-05-07 11:17:34 +02:00
trace_printk.c tracing/ftrace: factorize the tracing files creation 2009-04-07 14:43:07 +02:00
trace_sched_switch.c tracing/events: move trace point headers into include/trace/events 2009-04-14 22:05:43 -04:00
trace_sched_wakeup.c tracing/wakeup: move access to wakeup_cpu into spinlock 2009-04-23 23:01:36 -04:00
trace_selftest_dynamic.c ftrace: fix dynamic ftrace selftest 2008-05-23 21:13:23 +02:00
trace_selftest.c x86, hw-branch-tracer: allocate selftest iterator on heap 2009-04-07 13:36:21 +02:00
trace_stack.c tracing/trace_stack: fix the number of entries in the header 2009-06-03 10:24:44 -04:00
trace_stat.c tracing/stat: remove unappropriate safe walk on list 2009-06-02 01:18:33 +02:00
trace_stat.h tracing: add handler to trace_stat 2009-03-24 23:22:58 -04:00
trace_syscalls.c tracing/syscalls: use a dedicated file header 2009-04-09 05:43:32 +02:00
trace_sysprof.c tracing/ftrace: factorize the tracing files creation 2009-04-07 14:43:07 +02:00
trace_workqueue.c trace_workqueue: remove blank line between each cpu 2009-06-02 01:14:26 +02:00
trace.c tracing: replace a GFP_ATOMIC with GFP_KERNEL allocation 2009-06-15 11:37:14 -04:00
trace.h Merge branch 'tracing/hw-branch-tracing' into tracing/core 2009-05-07 13:36:22 +02:00