syzbot


possible deadlock in ftrace_profile_set_filter

Status: upstream: reported C repro on 2019/04/16 20:57
Reported-by: syzbot+ca6c4944f8e1acff7742@syzkaller.appspotmail.com
First crash: 1890d, last: 469d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ftrace_profile_set_filter (2) trace C 1007 2329d 2389d 5/27 fixed on 2018/04/24 21:47
upstream possible deadlock in ftrace_profile_set_filter 2 2471d 2423d 0/27 closed as invalid on 2017/10/30 19:48

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
4.14.300-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor331/7979 is trying to acquire lock:
 (event_mutex){+.+.}, at: [<ffffffff815bd284>] ftrace_profile_set_filter+0x64/0x1c0 kernel/trace/trace_events_filter.c:2268

but task is already holding lock:
 (&cpuctx_mutex){+.+.}, at: [<ffffffff81636add>] perf_event_ctx_lock_nested+0x14d/0x2c0 kernel/events/core.c:1241

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #4 (&cpuctx_mutex){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       perf_event_init_cpu+0xb7/0x170 kernel/events/core.c:11286
       perf_event_init+0x2cc/0x308 kernel/events/core.c:11333
       start_kernel+0x45d/0x763 init/main.c:624
       secondary_startup_64+0xa5/0xb0 arch/x86/kernel/head_64.S:240

-> #3 (pmus_lock){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       perf_event_init_cpu+0x2c/0x170 kernel/events/core.c:11280
       cpuhp_invoke_callback+0x1e6/0x1a80 kernel/cpu.c:186
       cpuhp_up_callbacks kernel/cpu.c:574 [inline]
       _cpu_up+0x21e/0x520 kernel/cpu.c:1193
       do_cpu_up+0x9a/0x160 kernel/cpu.c:1229
       smp_init+0x197/0x1ac kernel/smp.c:578
       kernel_init_freeable+0x406/0x626 init/main.c:1074
       kernel_init+0xd/0x167 init/main.c:1006
       ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:406

-> #2 (cpu_hotplug_lock.rw_sem){++++}:
       percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 [inline]
       percpu_down_read include/linux/percpu-rwsem.h:59 [inline]
       cpus_read_lock+0x39/0xc0 kernel/cpu.c:297
       static_key_slow_inc+0xe/0x20 kernel/jump_label.c:123
       tracepoint_add_func+0x747/0xa40 kernel/tracepoint.c:269
       tracepoint_probe_register_prio kernel/tracepoint.c:331 [inline]
       tracepoint_probe_register+0x8c/0xc0 kernel/tracepoint.c:352
       trace_event_reg+0x272/0x330 kernel/trace/trace_events.c:305
       perf_trace_event_reg kernel/trace/trace_event_perf.c:122 [inline]
       perf_trace_event_init kernel/trace/trace_event_perf.c:197 [inline]
       perf_trace_init+0x424/0xa30 kernel/trace/trace_event_perf.c:221
       perf_tp_event_init+0x79/0xf0 kernel/events/core.c:8140
       perf_try_init_event+0x15b/0x1f0 kernel/events/core.c:9374
       perf_init_event kernel/events/core.c:9412 [inline]
       perf_event_alloc.part.0+0xe2d/0x2640 kernel/events/core.c:9672
       perf_event_alloc kernel/events/core.c:10042 [inline]
       SYSC_perf_event_open kernel/events/core.c:10146 [inline]
       SyS_perf_event_open+0x683/0x2530 kernel/events/core.c:10032
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x5e/0xd3

-> #1 (tracepoints_mutex){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       tracepoint_probe_register_prio kernel/tracepoint.c:327 [inline]
       tracepoint_probe_register+0x68/0xc0 kernel/tracepoint.c:352
       trace_event_reg+0x272/0x330 kernel/trace/trace_events.c:305
       perf_trace_event_reg kernel/trace/trace_event_perf.c:122 [inline]
       perf_trace_event_init kernel/trace/trace_event_perf.c:197 [inline]
       perf_trace_init+0x424/0xa30 kernel/trace/trace_event_perf.c:221
       perf_tp_event_init+0x79/0xf0 kernel/events/core.c:8140
       perf_try_init_event+0x15b/0x1f0 kernel/events/core.c:9374
       perf_init_event kernel/events/core.c:9412 [inline]
       perf_event_alloc.part.0+0xe2d/0x2640 kernel/events/core.c:9672
       perf_event_alloc kernel/events/core.c:10042 [inline]
       SYSC_perf_event_open kernel/events/core.c:10146 [inline]
       SyS_perf_event_open+0x683/0x2530 kernel/events/core.c:10032
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x5e/0xd3

-> #0 (event_mutex){+.+.}:
       lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       ftrace_profile_set_filter+0x64/0x1c0 kernel/trace/trace_events_filter.c:2268
       perf_event_set_filter kernel/events/core.c:8724 [inline]
       _perf_ioctl+0x12b3/0x1a60 kernel/events/core.c:4852
       perf_ioctl+0x55/0x80 kernel/events/core.c:4889
       vfs_ioctl fs/ioctl.c:46 [inline]
       file_ioctl fs/ioctl.c:500 [inline]
       do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684
       SYSC_ioctl fs/ioctl.c:701 [inline]
       SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x5e/0xd3

other info that might help us debug this:

Chain exists of:
  event_mutex --> pmus_lock --> &cpuctx_mutex

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&cpuctx_mutex);
                               lock(pmus_lock);
                               lock(&cpuctx_mutex);
  lock(event_mutex);

 *** DEADLOCK ***

1 lock held by syz-executor331/7979:
 #0:  (&cpuctx_mutex){+.+.}, at: [<ffffffff81636add>] perf_event_ctx_lock_nested+0x14d/0x2c0 kernel/events/core.c:1241

stack backtrace:
CPU: 1 PID: 7979 Comm: syz-executor331 Not tainted 4.14.300-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258
 check_prev_add kernel/locking/lockdep.c:1905 [inline]
 check_prevs_add kernel/locking/lockdep.c:2022 [inline]
 validate_chain kernel/locking/lockdep.c:2464 [inline]
 __lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
 __mutex_lock_common kernel/locking/mutex.c:756 [inline]
 __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
 ftrace_profile_set_filter+0x64/0x1c0 kernel/trace/trace_events_filter.c:2268
 perf_event_set_filter kernel/events/core.c:8724 [inline]
 _perf_ioctl+0x12b3/0x1a60 kernel/events/core.c:4852
 perf_ioctl+0x55/0x80 kernel/events/core.c:4889
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684

Crashes (14295):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/11/27 18:41 linux-4.14.y 179ef7fe8677 f4470a7b .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2022/08/19 16:40 linux-4.14.y b641242202ed 26a13b38 .config console log report syz C ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2022/05/11 14:45 linux-4.14.y e3a56aaade89 8d7b3b67 .config console log report syz C ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2021/07/27 10:02 linux-4.14.y 964f3712e6a7 fd511809 .config console log report syz C ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2021/01/03 04:12 linux-4.14.y 1752938529c6 79264ae3 .config console log report syz C ci2-linux-4-14
2019/04/16 20:32 linux-4.14.y 1ec8f1f0bffe 505ab413 .config console log report syz C ci2-linux-4-14
2023/03/07 09:38 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/07 06:46 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/07 03:51 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/06 23:52 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/06 19:43 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/06 17:13 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/06 13:56 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/06 10:21 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/06 09:07 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/06 05:00 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/06 05:00 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/06 02:56 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/05 23:12 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/05 18:56 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/05 14:23 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/05 10:36 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/05 09:18 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/05 07:33 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/05 04:43 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/05 02:42 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/04 21:25 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/04 17:45 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/04 15:38 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/04 14:15 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/04 12:25 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/04 09:15 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/04 07:10 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/04 05:01 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/03 19:46 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/03 17:51 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/03 15:28 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/03 06:03 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/03 05:53 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/03 02:25 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/03 00:59 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/02 19:31 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/02 16:24 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/02 15:15 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/02 13:08 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/02 06:19 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/02 06:16 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/02 04:52 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/02 03:51 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/02 01:37 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/01 23:22 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/01 21:08 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/01 18:49 linux-4.14.y 7878a41b6cc1 ef65e6cb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/01 12:13 linux-4.14.y 7878a41b6cc1 ef65e6cb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/01 10:10 linux-4.14.y 7878a41b6cc1 ef65e6cb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/01 08:16 linux-4.14.y 7878a41b6cc1 ef65e6cb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2023/03/01 06:48 linux-4.14.y 7878a41b6cc1 95aee97a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in ftrace_profile_set_filter
2021/01/17 13:05 linux-4.14.y f79dc86058bc 813be542 .config console log report info ci2-linux-4-14
* Struck through repros no longer work on HEAD.