Jens Axboe
a6da0024ff
blktrace: fix unlocked registration of tracepoints
We need to ensure that tracepoints are registered and unregistered
with the users of them. The existing atomic count isn't enough for
that. Add a lock around the tracepoints, so we serialize access
to them.
This fixes cases where we have multiple users setting up and
tearing down tracepoints, like this:
CPU: 0 PID: 2995 Comm: syzkaller857118 Not tainted
4.14.0-rc5-next-20171018+ #36
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:16 [inline]
dump_stack+0x194/0x257 lib/dump_stack.c:52
panic+0x1e4/0x41c kernel/panic.c:183
__warn+0x1c4/0x1e0 kernel/panic.c:546
report_bug+0x211/0x2d0 lib/bug.c:183
fixup_bug+0x40/0x90 arch/x86/kernel/traps.c:177
do_trap_no_signal arch/x86/kernel/traps.c:211 [inline]
do_trap+0x260/0x390 arch/x86/kernel/traps.c:260
do_error_trap+0x120/0x390 arch/x86/kernel/traps.c:297
do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:310
invalid_op+0x18/0x20 arch/x86/entry/entry_64.S:905
RIP: 0010:tracepoint_add_func kernel/tracepoint.c:210 [inline]
RIP: 0010:tracepoint_probe_register_prio+0x397/0x9a0 kernel/tracepoint.c:283
RSP: 0018:ffff8801d1d1f6c0 EFLAGS: 00010293
RAX: ffff8801d22e8540 RBX: 00000000ffffffef RCX: ffffffff81710f07
RDX: 0000000000000000 RSI: ffffffff85b679c0 RDI: ffff8801d5f19818
RBP: ffff8801d1d1f7c8 R08: ffffffff81710c10 R09: 0000000000000004
R10: ffff8801d1d1f6b0 R11: 0000000000000003 R12: ffffffff817597f0
R13: 0000000000000000 R14: 00000000ffffffff R15: ffff8801d1d1f7a0
tracepoint_probe_register+0x2a/0x40 kernel/tracepoint.c:304
register_trace_block_rq_insert include/trace/events/block.h:191 [inline]
blk_register_tracepoints+0x1e/0x2f0 kernel/trace/blktrace.c:1043
do_blk_trace_setup+0xa10/0xcf0 kernel/trace/blktrace.c:542
blk_trace_setup+0xbd/0x180 kernel/trace/blktrace.c:564
sg_ioctl+0xc71/0x2d90 drivers/scsi/sg.c:1089
vfs_ioctl fs/ioctl.c:45 [inline]
do_vfs_ioctl+0x1b1/0x1520 fs/ioctl.c:685
SYSC_ioctl fs/ioctl.c:700 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x444339
RSP: 002b:00007ffe05bb5b18 EFLAGS: 00000206 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000006d66c0 RCX: 0000000000444339
RDX: 000000002084cf90 RSI: 00000000c0481273 RDI: 0000000000000009
RBP: 0000000000000082 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000206 R12: ffffffffffffffff
R13: 00000000c0481273 R14: 0000000000000000 R15: 0000000000000000
since we can now run these in parallel. Ensure that the exported helpers
for doing this are grabbing the queue trace mutex.
Reported-by: Steven Rostedt <rostedt@goodmis.org>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
2017-11-10 19:53:25 -07:00 |
| .. |
|
blktrace.c
|
blktrace: fix unlocked registration of tracepoints
|
2017-11-10 19:53:25 -07:00 |
|
bpf_trace.c
|
bpf: fix bpf_trace_printk on 32 bit archs
|
2017-08-15 17:32:15 -07:00 |
|
ftrace.c
|
ftrace: Fix memleak when unregistering dynamic ops when tracing disabled
|
2017-09-01 13:55:49 -04:00 |
|
Kconfig
|
tracing: Rename update the enum_map file
|
2017-06-13 17:13:06 -04:00 |
|
Makefile
|
perf/core: Rename CONFIG_[UK]PROBE_EVENT to CONFIG_[UK]PROBE_EVENTS
|
2017-03-01 10:26:39 +01:00 |
|
power-traces.c
|
cpufreq: schedutil: New governor based on scheduler utilization data
|
2016-04-02 01:09:12 +02:00 |
|
ring_buffer.c
|
ring-buffer: Have ring_buffer_alloc_read_page() return error on offline CPU
|
2017-08-02 14:23:02 -04:00 |
|
ring_buffer_benchmark.c
|
ring-buffer: Have ring_buffer_alloc_read_page() return error on offline CPU
|
2017-08-02 14:23:02 -04:00 |
|
rpm-traces.c
|
PM / Runtime: Introduce trace points for tracing rpm_* functions
|
2011-09-27 22:53:27 +02:00 |
|
trace.c
|
tracing: Fix trace_pipe behavior for instance traces
|
2017-09-19 18:33:42 -04:00 |
|
trace.h
|
tracing: Ignore mmiotrace from kernel commandline
|
2017-09-19 12:36:01 -04:00 |
|
trace_benchmark.c
|
tracing: Have the trace_event benchmark thread call cond_resched_rcu_qs()
|
2017-04-17 15:21:19 -04:00 |
|
trace_benchmark.h
|
tracing: Have the reg function allow to fail
|
2016-12-09 09:13:30 -05:00 |
|
trace_branch.c
|
tracing: Add the constant count for branch tracer
|
2017-01-19 08:57:41 -05:00 |
|
trace_clock.c
|
sched/headers: Prepare for new header dependencies before moving code to <linux/sched/clock.h>
|
2017-03-02 08:42:27 +01:00 |
|
trace_entries.h
|
trace: make trace_hwlat timestamp y2038 safe
|
2017-05-08 17:15:15 -07:00 |
|
trace_event_perf.c
|
perf/ftrace: Fix double traces of perf on ftrace:function
|
2017-08-29 13:29:29 +02:00 |
|
trace_events.c
|
tracing: Fix clear of RECORDED_TGID flag when disabling trace event
|
2017-09-05 12:00:09 -04:00 |
|
trace_events_filter.c
|
mm: treewide: remove GFP_TEMPORARY allocation flag
|
2017-09-13 18:53:16 -07:00 |
|
trace_events_filter_test.h
|
tracing/filter: Add startup tests for events filter
|
2011-08-19 14:35:59 -04:00 |
|
trace_events_hist.c
|
sched/headers: Prepare to use <linux/rcuupdate.h> instead of <linux/rculist.h> in <linux/sched.h>
|
2017-03-02 08:42:38 +01:00 |
|
trace_events_trigger.c
|
sched/headers: Prepare to use <linux/rcuupdate.h> instead of <linux/rculist.h> in <linux/sched.h>
|
2017-03-02 08:42:38 +01:00 |
|
trace_export.c
|
tracing: ftrace_event_is_function() can return boolean
|
2015-11-02 14:28:05 -05:00 |
|
trace_functions.c
|
ftrace: Fix regression with module command in stack_trace_filter
|
2017-06-29 10:05:45 -04:00 |
|
trace_functions_graph.c
|
treewide: make "nr_cpu_ids" unsigned
|
2017-09-08 18:26:48 -07:00 |
|
trace_hwlat.c
|
trace: make trace_hwlat timestamp y2038 safe
|
2017-05-08 17:15:15 -07:00 |
|
trace_irqsoff.c
|
clocksource: Use a plain u64 instead of cycle_t
|
2016-12-25 11:04:12 +01:00 |
|
trace_kdb.c
|
tracing: Move trace_flags from global to a trace_array field
|
2015-09-30 15:22:55 -04:00 |
|
trace_kprobe.c
|
perf/ftrace: Fix double traces of perf on ftrace:function
|
2017-08-29 13:29:29 +02:00 |
|
trace_mmiotrace.c
|
tracing: Ignore mmiotrace from kernel commandline
|
2017-09-19 12:36:01 -04:00 |
|
trace_nop.c
|
tracing: Fix typoes in code comment and printk in trace_nop.c
|
2016-03-08 11:23:57 -05:00 |
|
trace_output.c
|
tracing: Add support for display of tgid in trace output
|
2017-06-27 13:30:28 -04:00 |
|
trace_output.h
|
tracing: Turn seq_print_user_ip() into a static function
|
2015-09-28 10:16:12 -04:00 |
|
trace_printk.c
|
tracing: Handle NULL formats in hold_module_trace_bprintk_format()
|
2016-06-20 09:46:12 -04:00 |
|
trace_probe.c
|
tracing/probes: Fix a warning message to show correct maximum length
|
2017-02-15 10:32:48 -05:00 |
|
trace_probe.h
|
perf/core: Rename CONFIG_[UK]PROBE_EVENT to CONFIG_[UK]PROBE_EVENTS
|
2017-03-01 10:26:39 +01:00 |
|
trace_sched_switch.c
|
tracing: Add support for recording tgid of tasks
|
2017-06-27 13:30:28 -04:00 |
|
trace_sched_wakeup.c
|
clocksource: Use a plain u64 instead of cycle_t
|
2016-12-25 11:04:12 +01:00 |
|
trace_selftest.c
|
ftrace: Fix selftest goto location on error
|
2017-09-01 12:04:09 -04:00 |
|
trace_selftest_dynamic.c
|
ftrace: Add self-tests for multiple function trace users
|
2011-05-18 19:24:51 -04:00 |
|
trace_seq.c
|
tracing: use %*pb[l] to print bitmaps including cpumasks and nodemasks
|
2015-02-13 21:21:37 -08:00 |
|
trace_stack.c
|
tracing: Remove RCU work arounds from stack tracer
|
2017-09-23 16:50:20 -04:00 |
|
trace_stat.c
|
kernel/...: convert pr_warning to pr_warn
|
2016-03-22 15:36:02 -07:00 |
|
trace_stat.h
|
tracing/stat: Add stat_release() callback
|
2009-07-10 12:14:05 +02:00 |
|
trace_syscalls.c
|
perf/bpf: fix a clang compilation issue
|
2017-09-11 14:28:45 -07:00 |
|
trace_uprobe.c
|
perf/ftrace: Fix double traces of perf on ftrace:function
|
2017-08-29 13:29:29 +02:00 |
|
tracing_map.c
|
tracing: Fix kmemleak in tracing_map_array_free()
|
2017-08-24 10:05:51 -04:00 |
|
tracing_map.h
|
tracing: Update some tracing_map constants and comments
|
2016-04-19 12:16:06 -04:00 |