Steven Rostedt (VMware)
82cc4fc2e7
ftrace: Fix removing of second function probe
...
When two function probes are added to set_ftrace_filter, and then one of
them is removed, the update to the function locations is not performed, and
the record keeping of the function states are corrupted, and causes an
ftrace_bug() to occur.
This is easily reproducable by adding two probes, removing one, and then
adding it back again.
# cd /sys/kernel/debug/tracing
# echo schedule:traceoff > set_ftrace_filter
# echo do_IRQ:traceoff > set_ftrace_filter
# echo \!do_IRQ:traceoff > /debug/tracing/set_ftrace_filter
# echo do_IRQ:traceoff > set_ftrace_filter
Causes:
------------[ cut here ]------------
WARNING: CPU: 2 PID: 1098 at kernel/trace/ftrace.c:2369 ftrace_get_addr_curr+0x143/0x220
Modules linked in: [...]
CPU: 2 PID: 1098 Comm: bash Not tainted 4.10.0-test+ #405
Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01 v02.05 05/07/2012
Call Trace:
dump_stack+0x68/0x9f
__warn+0x111/0x130
? trace_irq_work_interrupt+0xa0/0xa0
warn_slowpath_null+0x1d/0x20
ftrace_get_addr_curr+0x143/0x220
? __fentry__+0x10/0x10
ftrace_replace_code+0xe3/0x4f0
? ftrace_int3_handler+0x90/0x90
? printk+0x99/0xb5
? 0xffffffff81000000
ftrace_modify_all_code+0x97/0x110
arch_ftrace_update_code+0x10/0x20
ftrace_run_update_code+0x1c/0x60
ftrace_run_modify_code.isra.48.constprop.62+0x8e/0xd0
register_ftrace_function_probe+0x4b6/0x590
? ftrace_startup+0x310/0x310
? debug_lockdep_rcu_enabled.part.4+0x1a/0x30
? update_stack_state+0x88/0x110
? ftrace_regex_write.isra.43.part.44+0x1d3/0x320
? preempt_count_sub+0x18/0xd0
? mutex_lock_nested+0x104/0x800
? ftrace_regex_write.isra.43.part.44+0x1d3/0x320
? __unwind_start+0x1c0/0x1c0
? _mutex_lock_nest_lock+0x800/0x800
ftrace_trace_probe_callback.isra.3+0xc0/0x130
? func_set_flag+0xe0/0xe0
? __lock_acquire+0x642/0x1790
? __might_fault+0x1e/0x20
? trace_get_user+0x398/0x470
? strcmp+0x35/0x60
ftrace_trace_onoff_callback+0x48/0x70
ftrace_regex_write.isra.43.part.44+0x251/0x320
? match_records+0x420/0x420
ftrace_filter_write+0x2b/0x30
__vfs_write+0xd7/0x330
? do_loop_readv_writev+0x120/0x120
? locks_remove_posix+0x90/0x2f0
? do_lock_file_wait+0x160/0x160
? __lock_is_held+0x93/0x100
? rcu_read_lock_sched_held+0x5c/0xb0
? preempt_count_sub+0x18/0xd0
? __sb_start_write+0x10a/0x230
? vfs_write+0x222/0x240
vfs_write+0xef/0x240
SyS_write+0xab/0x130
? SyS_read+0x130/0x130
? trace_hardirqs_on_caller+0x182/0x280
? trace_hardirqs_on_thunk+0x1a/0x1c
entry_SYSCALL_64_fastpath+0x18/0xad
RIP: 0033:0x7fe61c157c30
RSP: 002b:00007ffe87890258 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: ffffffff8114a410 RCX: 00007fe61c157c30
RDX: 0000000000000010 RSI: 000055814798f5e0 RDI: 0000000000000001
RBP: ffff8800c9027f98 R08: 00007fe61c422740 R09: 00007fe61ca53700
R10: 0000000000000073 R11: 0000000000000246 R12: 0000558147a36400
R13: 00007ffe8788f160 R14: 0000000000000024 R15: 00007ffe8788f15c
? trace_hardirqs_off_caller+0xc0/0x110
---[ end trace 99fa09b3d9869c2c ]---
Bad trampoline accounting at: ffffffff81cc3b00 (do_IRQ+0x0/0x150)
Cc: stable@vger.kernel.org
Fixes: 59df055f1991 ("ftrace: trace different functions with a different tracer")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-14 17:54:22 -04:00
..
2017-03-22 14:12:18 -07:00
2017-03-14 15:11:19 -07:00
2017-02-27 18:43:46 -08:00
2017-03-02 08:42:34 +01:00
2017-03-17 13:59:52 -07:00
2017-03-02 08:42:40 +01:00
2016-08-26 14:42:08 +02:00
2017-03-16 09:28:30 +01:00
2017-03-03 10:16:38 -08:00
2017-03-02 08:42:36 +01:00
2017-03-02 08:42:34 +01:00
2017-04-02 09:25:10 -07:00
2017-03-07 14:45:22 -08:00
2017-04-14 17:54:22 -04:00
2017-03-02 08:42:39 +01:00
2016-12-17 18:44:00 -08:00
2017-01-05 23:06:06 -08:00
2016-12-17 18:44:00 -08:00
2017-03-21 11:26:35 -04:00
2017-03-21 11:26:35 -04:00
2016-11-29 15:10:12 -05:00
2017-03-21 11:26:35 -04:00
2017-01-12 07:01:56 -07:00
2016-12-24 11:46:01 -08:00
2016-12-24 11:46:01 -08:00
2017-03-14 19:19:27 +01:00
2017-03-02 08:42:28 +01:00
2017-03-02 08:42:39 +01:00
2017-03-09 17:01:09 -08:00
2017-02-22 10:15:09 -08:00
2017-03-03 01:43:46 +01:00
2016-12-24 11:46:01 -08:00
2017-03-14 21:45:36 +01:00
2016-12-24 11:46:01 -08:00
2017-03-02 08:42:34 +01:00
2017-02-27 13:26:17 -08:00
2017-02-17 13:40:05 -05:00
2016-10-25 11:31:51 +02:00
2016-12-20 09:48:47 -08:00
2017-02-22 17:33:34 -08:00
2017-03-10 20:55:09 +01:00
2017-03-10 20:55:09 +01:00
2017-03-02 08:42:39 +01:00
2017-02-22 10:30:38 -08:00
2017-02-24 17:46:56 -08:00
2017-03-02 08:42:35 +01:00
2017-03-02 08:42:39 +01:00
2016-12-27 14:49:05 -05:00
2017-01-23 11:32:16 -08:00
2017-03-16 16:56:18 -07:00
2017-02-22 17:08:33 -08:00
2017-02-24 17:46:56 -08:00
2017-03-24 21:51:33 +08:00
2017-03-02 08:42:34 +01:00
2017-03-02 08:42:37 +01:00
2017-03-02 08:42:35 +01:00
2017-03-02 08:42:39 +01:00
2017-03-02 08:42:35 +01:00
2017-02-27 18:43:47 -08:00
2017-03-02 08:42:36 +01:00
2017-03-02 08:42:39 +01:00
2017-03-02 08:42:26 +01:00
2017-03-02 08:42:35 +01:00
2016-10-21 15:45:47 -06:00
2017-02-08 08:21:31 +01:00
2016-11-16 10:15:09 +01:00
2016-12-22 22:58:37 -05:00
2017-03-02 08:42:39 +01:00
2016-12-14 16:04:07 -08:00
2017-03-02 08:42:28 +01:00
2016-11-15 10:54:36 -05:00
2017-03-02 08:42:27 +01:00
2017-03-02 08:42:35 +01:00
2017-03-02 08:42:39 +01:00
2017-03-06 15:26:37 -06:00
2017-03-02 08:42:31 +01:00
2016-09-05 13:52:39 +02:00
2017-03-02 08:42:29 +01:00
2017-03-02 08:42:29 +01:00
2017-03-03 01:45:36 +01:00
2017-03-02 08:42:38 +01:00
2017-03-02 08:42:34 +01:00
2017-03-02 08:42:34 +01:00
2017-03-06 15:33:42 -05:00