1
0
Fork 0
alistair23-linux/kernel/trace
Steven Rostedt 9456f0fa6d tracing: reset ring buffer when removing modules with events
Li Zefan found that there's a race using the event ids of events and
modules. When a module is loaded, an event id is incremented. We only
have 16 bits for event ids (65536) and there is a possible (but highly
unlikely) race that we could load and unload a module that registers
events so many times that the event id counter overflows.

When it overflows, it then restarts and goes looking for available
ids. An id is available if it was added by a module and released.

The race is if you have one module add an id, and then is removed.
Another module loaded can use that same event id. But if the old module
still had events in the ring buffer, the new module's call back would
get bogus data.  At best (and most likely) the output would just be
garbage. But if the module for some reason used pointers (not recommended)
then this could potentially crash.

The safest thing to do is just reset the ring buffer if a module that
registered events is removed.

[ Impact: prevent unpredictable results of event id overflows ]

Reported-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <49FEAFD0.30106@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2009-05-06 23:11:41 -04:00
..
Kconfig ring-buffer: add benchmark and tester 2009-05-06 00:08:50 -04:00
Makefile ring-buffer: add benchmark and tester 2009-05-06 00:08:50 -04:00
blktrace.c blktrace: from-sector redundant in trace_block_remap 2009-05-06 14:13:01 +02:00
ftrace.c ftrace: use module notifier for function tracer 2009-04-17 16:59:15 +02:00
kmemtrace.c tracing/filters: use ring_buffer_discard_commit() in filter_check_discard() 2009-04-14 00:00:56 +02:00
ring_buffer.c ring-buffer: make moving the tail page a separate function 2009-05-06 15:30:07 -04:00
ring_buffer_benchmark.c ring-buffer: change test to be more latency friendly 2009-05-06 18:36:59 -04:00
trace.c tracing: reset ring buffer when removing modules with events 2009-05-06 23:11:41 -04:00
trace.h tracing: reset ring buffer when removing modules with events 2009-05-06 23:11:41 -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 tracing/filters: use ring_buffer_discard_commit() in filter_check_discard() 2009-04-14 00:00:56 +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.c tracing: reset ring buffer when removing modules with events 2009-05-06 23:11:41 -04:00
trace_events_filter.c tracing/events: fix concurrent access to ftrace_events list 2009-05-06 10:38:19 +02:00
trace_export.c tracing/filters: distinguish between signed and unsigned fields 2009-04-29 14:06:03 +02:00
trace_functions.c tracing/core: use appropriate waiting on trace_pipe 2009-02-18 01:40:20 +01:00
trace_functions_graph.c function-graph: add option to calculate graph time or not 2009-03-24 23:41:11 -04:00
trace_hw_branches.c tracing/filters: use ring_buffer_discard_commit() in filter_check_discard() 2009-04-14 00:00:56 +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: trace_output.c, fix false positive compiler warning 2009-05-06 14:19:16 +02:00
trace_output.h tracing/events: move declarations from trace directory to core include 2009-04-14 12:57:58 -04:00
trace_power.c tracing/filters: use ring_buffer_discard_commit() in filter_check_discard() 2009-04-14 00:00:56 +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.c tracing: keep the tracing buffer after self-test failure 2009-03-22 15:17:21 +01:00
trace_selftest_dynamic.c ftrace: fix dynamic ftrace selftest 2008-05-23 21:13:23 +02:00
trace_stack.c tracing/ftrace: factorize the tracing files creation 2009-04-07 14:43:07 +02:00
trace_stat.c Merge branch 'linus' into tracing/core 2009-04-07 13:47:45 +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 Merge branch 'linus' into tracing/core 2009-04-07 13:47:45 +02:00