Jens Axboe
7569adcf39
blktrace: fix unlocked registration of tracepoints
commit a6da0024ffc19e0d47712bb5ca4fd083f76b07df upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
2018-02-25 11:05:41 +01:00 |
| .. |
|
blktrace.c
|
blktrace: fix unlocked registration of tracepoints
|
2018-02-25 11:05:41 +01:00 |
|
bpf_trace.c
|
bpf: fix bpf_trace_printk on 32 bit archs
|
2017-08-30 10:21:39 +02:00 |
|
ftrace.c
|
ftrace: Remove incorrect setting of glob search field
|
2018-02-17 13:21:20 +01:00 |
|
Kconfig
|
This release cycle is rather small. Just a few fixes to tracing.
|
2016-10-06 11:48:41 -07:00 |
|
Makefile
|
Disable the __builtin_return_address() warning globally after all
|
2016-10-12 10:23:41 -07: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: Mask out the info bits when returning buffer page length
|
2018-01-02 20:35:07 +01:00 |
|
ring_buffer_benchmark.c
|
ring_buffer: Remove unneeded smp_wmb() before wakeup of reader benchmark
|
2015-11-03 16:19:02 -05:00 |
|
rpm-traces.c
|
|
|
|
trace.c
|
tracing: Fix crash when it fails to alloc ring buffer
|
2018-01-02 20:35:07 +01:00 |
|
trace.h
|
ftrace: Fix function pid filter on instances
|
2017-04-21 09:31:22 +02:00 |
|
trace_benchmark.c
|
tracing: Only benchmark the time tracepoints take if tracing is on
|
2015-11-02 13:34:58 -05:00 |
|
trace_benchmark.h
|
tracing: Add tracepoint benchmark tracepoint
|
2014-05-29 22:49:54 -04:00 |
|
trace_branch.c
|
tracing: Remove {start,stop}_branch_trace
|
2015-10-21 10:10:09 -04:00 |
|
trace_clock.c
|
tracing: Export tracing clock functions
|
2015-05-12 15:56:57 -04:00 |
|
trace_entries.h
|
tracing: Add NMI tracing in hwlat detector
|
2016-09-02 12:47:55 -04:00 |
|
trace_event_perf.c
|
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
|
2016-05-17 16:26:30 -07:00 |
|
trace_events.c
|
tracing: Fix converting enum's from the map in trace_event_eval_update()
|
2018-01-23 19:57:07 +01:00 |
|
trace_events_filter.c
|
tracing: Fix freeing of filter in create_filter() when set_str is false
|
2017-08-30 10:21:49 +02:00 |
|
trace_events_filter_test.h
|
|
|
|
trace_events_hist.c
|
tracing: Exclude 'generic fields' from histograms
|
2017-12-25 14:23:44 +01:00 |
|
trace_events_trigger.c
|
tracing: Call traceoff trigger after event is recorded
|
2016-09-23 09:47:59 -04:00 |
|
trace_export.c
|
tracing: ftrace_event_is_function() can return boolean
|
2015-11-02 14:28:05 -05:00 |
|
trace_functions.c
|
ftrace: Have set_ftrace_pid use the bitmap like events do
|
2016-06-20 09:54:19 -04:00 |
|
trace_functions_graph.c
|
fgraph: Handle a case where a tracer ignores set_graph_notrace
|
2017-01-09 08:32:23 +01:00 |
|
trace_hwlat.c
|
tracing: Fix hwlat kthread migration
|
2017-02-09 08:08:28 +01:00 |
|
trace_irqsoff.c
|
tracing: Remove redundant reset per-CPU buff in irqsoff tracer
|
2016-03-18 16:39:11 -04: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
|
tracing/kprobes: Allow to create probe with a module name starting with a digit
|
2017-07-12 15:01:02 +02:00 |
|
trace_mmiotrace.c
|
tracing: Expose CPU physical addresses (resource values) for PCI devices
|
2016-06-20 09:54:22 -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 NMI tracing in hwlat detector
|
2016-09-02 12:47:55 -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
|
ftrace: kprobe: uprobe: Show u8/u16/u32/u64 types in decimal
|
2016-08-23 17:06:38 -03:00 |
|
trace_probe.h
|
ftrace: kprobe: uprobe: Show u8/u16/u32/u64 types in decimal
|
2016-08-23 17:06:38 -03:00 |
|
trace_sched_switch.c
|
sched/core: Fix trace_sched_switch()
|
2015-10-06 17:08:15 +02:00 |
|
trace_sched_wakeup.c
|
Most of the changes are clean ups and small fixes. Some of them have
|
2015-11-06 13:30:20 -08:00 |
|
trace_selftest.c
|
ftrace: Fix selftest goto location on error
|
2017-09-27 14:39:23 +02:00 |
|
trace_selftest_dynamic.c
|
|
|
|
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, kasan: Silence Kasan warning in check_stack of stack_tracer
|
2016-02-19 12:36:44 -05:00 |
|
trace_stat.c
|
kernel/...: convert pr_warning to pr_warn
|
2016-03-22 15:36:02 -07:00 |
|
trace_stat.h
|
|
|
|
trace_syscalls.c
|
tracing/syscalls: fix multiline in error message text
|
2016-09-29 10:25:23 +02:00 |
|
trace_uprobe.c
|
This release cycle is rather small. Just a few fixes to tracing.
|
2016-10-06 11:48:41 -07:00 |
|
tracing_map.c
|
tracing: Fix kmemleak in tracing_map_array_free()
|
2017-08-30 10:21:49 +02:00 |
|
tracing_map.h
|
tracing: Update some tracing_map constants and comments
|
2016-04-19 12:16:06 -04:00 |