mirror of
https://github.com/torvalds/linux.git
synced 2025-11-02 01:29:02 +02:00
A module will add/remove its trace events when it gets loaded/unloaded, so
the ftrace_events list is not "const", and concurrent access needs to be
protected.
This patch thus fixes races between loading/unloding modules and read
'available_events' or read/write 'set_event', etc.
Below shows how to reproduce the race:
# for ((; ;)) { cat /mnt/tracing/available_events; } > /dev/null &
# for ((; ;)) { insmod trace-events-sample.ko; rmmod sample; } &
After a while:
BUG: unable to handle kernel paging request at 0010011c
IP: [<c1080f27>] t_next+0x1b/0x2d
...
Call Trace:
[<c10c90e6>] ? seq_read+0x217/0x30d
[<c10c8ecf>] ? seq_read+0x0/0x30d
[<c10b4c19>] ? vfs_read+0x8f/0x136
[<c10b4fc3>] ? sys_read+0x40/0x65
[<c1002a68>] ? sysenter_do_call+0x12/0x36
[ Impact: fix races when concurrent accessing ftrace_events list ]
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <4A00F709.3080800@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
|
||
|---|---|---|
| .. | ||
| blktrace.c | ||
| ftrace.c | ||
| Kconfig | ||
| kmemtrace.c | ||
| Makefile | ||
| ring_buffer.c | ||
| ring_buffer_benchmark.c | ||
| trace.c | ||
| trace.h | ||
| trace_boot.c | ||
| trace_branch.c | ||
| trace_clock.c | ||
| trace_event_profile.c | ||
| trace_event_types.h | ||
| trace_events.c | ||
| trace_events_filter.c | ||
| trace_export.c | ||
| trace_functions.c | ||
| trace_functions_graph.c | ||
| trace_hw_branches.c | ||
| trace_irqsoff.c | ||
| trace_mmiotrace.c | ||
| trace_nop.c | ||
| trace_output.c | ||
| trace_output.h | ||
| trace_power.c | ||
| trace_printk.c | ||
| trace_sched_switch.c | ||
| trace_sched_wakeup.c | ||
| trace_selftest.c | ||
| trace_selftest_dynamic.c | ||
| trace_stack.c | ||
| trace_stat.c | ||
| trace_stat.h | ||
| trace_syscalls.c | ||
| trace_sysprof.c | ||
| trace_workqueue.c | ||