syzbot


possible deadlock in static_key_slow_inc

Status: auto-closed as invalid on 2022/05/31 03:42
Reported-by: syzbot+fd231b9ab5396121689e@syzkaller.appspotmail.com
First crash: 373d, last: 373d
similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in static_key_slow_inc 5 1990d 1925d 0/24 closed as invalid on 2017/10/31 11:27
linux-4.14 possible deadlock in static_key_slow_inc (2) C 2 1d15h 40d 0/1 upstream: reported C repro on 2022/12/29 19:42
upstream possible deadlock in static_key_slow_inc (2) C error 19970 now 97d 0/24 upstream: reported C repro on 2022/11/02 10:36

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
4.14.264-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.3/12283 is trying to acquire lock:
 (cpu_hotplug_lock.rw_sem){++++}, at: [<ffffffff8167adce>] static_key_slow_inc+0xe/0x20 kernel/jump_label.c:123

but task is already holding lock:
 (tracepoints_mutex){+.+.}, at: [<ffffffff81566f48>] tracepoint_probe_register_prio kernel/tracepoint.c:327 [inline]
 (tracepoints_mutex){+.+.}, at: [<ffffffff81566f48>] tracepoint_probe_register+0x68/0xc0 kernel/tracepoint.c:352

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #5 (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:9371
       perf_init_event kernel/events/core.c:9409 [inline]
       perf_event_alloc.part.0+0xe2d/0x2640 kernel/events/core.c:9669
       perf_event_alloc kernel/events/core.c:10022 [inline]
       SYSC_perf_event_open kernel/events/core.c:10126 [inline]
       SyS_perf_event_open+0x67f/0x24b0 kernel/events/core.c:10012
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

-> #4 (event_mutex){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       perf_trace_init+0x4f/0xa30 kernel/trace/trace_event_perf.c:216
       perf_tp_event_init+0x79/0xf0 kernel/events/core.c:8140
       perf_try_init_event+0xdf/0x1f0 kernel/events/core.c:9371
       perf_init_event kernel/events/core.c:9409 [inline]
       perf_event_alloc.part.0+0xe2d/0x2640 kernel/events/core.c:9669
       perf_event_alloc kernel/events/core.c:10022 [inline]
       SYSC_perf_event_open kernel/events/core.c:10126 [inline]
       SyS_perf_event_open+0x67f/0x24b0 kernel/events/core.c:10012
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

-> #3 (&cpuctx_mutex/1){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       mutex_lock_double kernel/events/core.c:9933 [inline]
       __perf_event_ctx_lock_double kernel/events/core.c:9992 [inline]
       SYSC_perf_event_open kernel/events/core.c:10254 [inline]
       SyS_perf_event_open+0xd28/0x24b0 kernel/events/core.c:10012
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

-> #2 (&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:11252
       perf_event_init+0x2cc/0x308 kernel/events/core.c:11299
       start_kernel+0x46a/0x770 init/main.c:620
       secondary_startup_64+0xa5/0xb0 arch/x86/kernel/head_64.S:240

-> #1 (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:11246
       cpuhp_invoke_callback+0x1e6/0x1a80 kernel/cpu.c:185
       cpuhp_up_callbacks kernel/cpu.c:573 [inline]
       _cpu_up+0x21e/0x520 kernel/cpu.c:1192
       do_cpu_up+0x9a/0x160 kernel/cpu.c:1228
       smp_init+0x197/0x1ac kernel/smp.c:578
       kernel_init_freeable+0x406/0x626 init/main.c:1068
       kernel_init+0xd/0x169 init/main.c:1000
       ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

-> #0 (cpu_hotplug_lock.rw_sem){++++}:
       lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
       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:296
       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:9371
       perf_init_event kernel/events/core.c:9409 [inline]
       perf_event_alloc.part.0+0xe2d/0x2640 kernel/events/core.c:9669
       perf_event_alloc kernel/events/core.c:10022 [inline]
       SYSC_perf_event_open kernel/events/core.c:10126 [inline]
       SyS_perf_event_open+0x67f/0x24b0 kernel/events/core.c:10012
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

other info that might help us debug this:

Chain exists of:
  cpu_hotplug_lock.rw_sem --> event_mutex --> tracepoints_mutex

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(tracepoints_mutex);
                               lock(event_mutex);
                               lock(tracepoints_mutex);
  lock(cpu_hotplug_lock.rw_sem);

 *** DEADLOCK ***

4 locks held by syz-executor.3/12283:
 #0:  (&sig->cred_guard_mutex){+.+.}, at: [<ffffffff816630df>] SYSC_perf_event_open kernel/events/core.c:10106 [inline]
 #0:  (&sig->cred_guard_mutex){+.+.}, at: [<ffffffff816630df>] SyS_perf_event_open+0x132f/0x24b0 kernel/events/core.c:10012
 #1:  (&pmus_srcu){....}, at: [<ffffffff816384e4>] fdput include/linux/file.h:40 [inline]
 #1:  (&pmus_srcu){....}, at: [<ffffffff816384e4>] perf_cgroup_connect kernel/events/core.c:849 [inline]
 #1:  (&pmus_srcu){....}, at: [<ffffffff816384e4>] perf_event_alloc.part.0+0xc44/0x2640 kernel/events/core.c:9664
 #2:  (event_mutex){+.+.}, at: [<ffffffff815afecf>] perf_trace_init+0x4f/0xa30 kernel/trace/trace_event_perf.c:216
 #3:  (tracepoints_mutex){+.+.}, at: [<ffffffff81566f48>] tracepoint_probe_register_prio kernel/tracepoint.c:327 [inline]
 #3:  (tracepoints_mutex){+.+.}, at: [<ffffffff81566f48>] tracepoint_probe_register+0x68/0xc0 kernel/tracepoint.c:352

stack backtrace:
CPU: 0 PID: 12283 Comm: syz-executor.3 Not tainted 4.14.264-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
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
 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:296
 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:9371
 perf_init_event kernel/events/core.c:9409 [inline]
 perf_event_alloc.part.0+0xe2d/0x2640 kernel/events/core.c:9669
 perf_event_alloc kernel/events/core.c:10022 [inline]
 SYSC_perf_event_open kernel/events/core.c:10126 [inline]
 SyS_perf_event_open+0x67f/0x24b0 kernel/events/core.c:10012
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x7fec482d0059
RSP: 002b:00007fec46c45168 EFLAGS: 00000246 ORIG_RAX: 000000000000012a
RAX: ffffffffffffffda RBX: 00007fec483e2f60 RCX: 00007fec482d0059
RDX: ffffffffffffffff RSI: 0000000000000000 RDI: 0000000020000000
RBP: 00007fec4832a08d R08: 0000000000000000 R09: 0000000000000000
R10: ffffffffffffffff R11: 0000000000000246 R12: 0000000000000000
R13: 00007fff49ba551f R14: 00007fec46c45300 R15: 0000000000022000
device lo entered promiscuous mode
Y4`Ҙ: renamed from lo
device lo entered promiscuous mode
Y4`Ҙ: renamed from lo
print_req_error: I/O error, dev loop0, sector 0
print_req_error: I/O error, dev loop0, sector 0
print_req_error: I/O error, dev loop0, sector 0
F2FS-fs (loop4): Magic Mismatch, valid(0xf2f52010) - read(0x0)
F2FS-fs (loop4): Can't find valid F2FS filesystem in 2th superblock
F2FS-fs (loop4): invalid crc value
F2FS-fs (loop4): Try to recover 2th superblock, ret: 0
F2FS-fs (loop4): Mounted with checkpoint version = 753bd00b
F2FS-fs (loop4): Magic Mismatch, valid(0xf2f52010) - read(0x0)
F2FS-fs (loop4): Can't find valid F2FS filesystem in 2th superblock
F2FS-fs (loop4): invalid crc value
F2FS-fs (loop4): Failed to initialize F2FS segment manager
F2FS-fs (loop4): Magic Mismatch, valid(0xf2f52010) - read(0x0)
cannot load conntrack support for proto=10
cannot load conntrack support for proto=10
unregister_netdevice: waiting for ip6gre0 to become free. Usage count = -1

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci2-linux-4-14 2022/01/31 03:38 linux-4.14.y b86ee2b7ae42 495e00c5 .config console log report info possible deadlock in static_key_slow_inc
* Struck through repros no longer work on HEAD.