syzbot


possible deadlock in static_key_slow_dec (3)

Status: auto-closed as invalid on 2022/03/22 05:24
Reported-by: syzbot+63b69a71f0d5917ca2b7@syzkaller.appspotmail.com
First crash: 1156d, last: 1108d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in static_key_slow_dec cgroups C done error 35 813d 2219d 0/28 auto-obsoleted due to no activity on 2023/01/11 02:59
linux-4.19 possible deadlock in static_key_slow_dec 1 1921d 1921d 0/1 auto-closed as invalid on 2019/12/30 04:27
linux-4.19 possible deadlock in static_key_slow_dec (2) 2 1425d 1509d 0/1 auto-closed as invalid on 2021/05/08 21:09

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
4.19.211-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.1/12294 is trying to acquire lock:
0000000003cadac1 (cpu_hotplug_lock.rw_sem){++++}, at: __static_key_slow_dec kernel/jump_label.c:222 [inline]
0000000003cadac1 (cpu_hotplug_lock.rw_sem){++++}, at: static_key_slow_dec+0x4f/0x90 kernel/jump_label.c:237

but task is already holding lock:
000000001c5216c2 (&mm->mmap_sem){++++}, at: vm_mmap_pgoff+0x152/0x200 mm/util.c:355

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&mm->mmap_sem){++++}:
       _copy_to_user+0x29/0x100 lib/usercopy.c:25
       copy_to_user include/linux/uaccess.h:155 [inline]
       perf_read_group kernel/events/core.c:4831 [inline]
       __perf_read kernel/events/core.c:4898 [inline]
       perf_read+0x699/0x860 kernel/events/core.c:4913
       do_loop_readv_writev fs/read_write.c:701 [inline]
       do_loop_readv_writev fs/read_write.c:688 [inline]
       do_iter_read+0x471/0x630 fs/read_write.c:925
       vfs_readv+0xe5/0x150 fs/read_write.c:987
       do_readv+0x136/0x330 fs/read_write.c:1020
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #2 (&cpuctx_mutex){+.+.}:
       perf_event_init_cpu+0xc4/0x170 kernel/events/core.c:11828
       perf_event_init+0x309/0x34e kernel/events/core.c:11875
       start_kernel+0x5b1/0x911 init/main.c:644
       secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243

-> #1 (pmus_lock){+.+.}:
       perf_event_init_cpu+0x2c/0x170 kernel/events/core.c:11822
       cpuhp_invoke_callback+0x201/0x1b80 kernel/cpu.c:170
       cpuhp_up_callbacks kernel/cpu.c:584 [inline]
       _cpu_up+0x25c/0x540 kernel/cpu.c:1192
       do_cpu_up+0xdd/0x1b0 kernel/cpu.c:1228
       smp_init+0x1ed/0x202 kernel/smp.c:578
       kernel_init_freeable+0x62b/0xab7 init/main.c:1138
       kernel_init+0xd/0x1ba init/main.c:1062
       ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

-> #0 (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+0x3b/0xd0 kernel/cpu.c:290
       __static_key_slow_dec kernel/jump_label.c:222 [inline]
       static_key_slow_dec+0x4f/0x90 kernel/jump_label.c:237
       sw_perf_event_destroy+0x8a/0x120 kernel/events/core.c:8311
       _free_event+0x32c/0x1150 kernel/events/core.c:4484
       put_event kernel/events/core.c:4578 [inline]
       perf_mmap_close+0x6f6/0xea0 kernel/events/core.c:5582
       remove_vma+0xa9/0x170 mm/mmap.c:176
       remove_vma_list mm/mmap.c:2550 [inline]
       do_munmap+0x6f9/0xde0 mm/mmap.c:2786
       mmap_region+0x2a3/0x16b0 mm/mmap.c:1700
       do_mmap+0x8e8/0x1080 mm/mmap.c:1530
       do_mmap_pgoff include/linux/mm.h:2329 [inline]
       vm_mmap_pgoff+0x197/0x200 mm/util.c:357
       ksys_mmap_pgoff+0x298/0x5a0 mm/mmap.c:1580
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

other info that might help us debug this:

Chain exists of:
  cpu_hotplug_lock.rw_sem --> &cpuctx_mutex --> &mm->mmap_sem

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&mm->mmap_sem);
                               lock(&cpuctx_mutex);
                               lock(&mm->mmap_sem);
  lock(cpu_hotplug_lock.rw_sem);

 *** DEADLOCK ***

1 lock held by syz-executor.1/12294:
 #0: 000000001c5216c2 (&mm->mmap_sem){++++}, at: vm_mmap_pgoff+0x152/0x200 mm/util.c:355

stack backtrace:
CPU: 0 PID: 12294 Comm: syz-executor.1 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1222
 check_prev_add kernel/locking/lockdep.c:1866 [inline]
 check_prevs_add kernel/locking/lockdep.c:1979 [inline]
 validate_chain kernel/locking/lockdep.c:2420 [inline]
 __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3416
 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908
 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+0x3b/0xd0 kernel/cpu.c:290
 __static_key_slow_dec kernel/jump_label.c:222 [inline]
 static_key_slow_dec+0x4f/0x90 kernel/jump_label.c:237
 sw_perf_event_destroy+0x8a/0x120 kernel/events/core.c:8311
 _free_event+0x32c/0x1150 kernel/events/core.c:4484
 put_event kernel/events/core.c:4578 [inline]
 perf_mmap_close+0x6f6/0xea0 kernel/events/core.c:5582
 remove_vma+0xa9/0x170 mm/mmap.c:176
 remove_vma_list mm/mmap.c:2550 [inline]
 do_munmap+0x6f9/0xde0 mm/mmap.c:2786
 mmap_region+0x2a3/0x16b0 mm/mmap.c:1700
 do_mmap+0x8e8/0x1080 mm/mmap.c:1530
UDF-fs: bad mount option "‡Cˆh¥v¦üÿÿÿü¯Ãoý¶*Bˆà³í£€" or missing value
 do_mmap_pgoff include/linux/mm.h:2329 [inline]
 vm_mmap_pgoff+0x197/0x200 mm/util.c:357
 ksys_mmap_pgoff+0x298/0x5a0 mm/mmap.c:1580
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7fe1d7f54ae9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe1d54a9188 EFLAGS: 00000246 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 00007fe1d8068020 RCX: 00007fe1d7f54ae9
RDX: 0000000000000000 RSI: 0000000000003000 RDI: 0000000020ffd000
RBP: 00007fe1d7faef6d R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000011 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffdf886083f R14: 00007fe1d54a9300 R15: 0000000000022000
nla_parse: 3 callbacks suppressed
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.2'.
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.1'.
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.1'.
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.0'.
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.0'.
audit: type=1800 audit(1637558599.197:312): pid=12450 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed comm="syz-executor.4" name="cpuacct.usage_percpu_sys" dev="sda1" ino=14447 res=0
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.0'.
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.0'.
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.0'.
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.0'.
overlayfs: fs on './file0' does not support file handles, falling back to index=off,nfs_export=off.
overlayfs: './bus' not a directory
overlayfs: lowerdir is in-use as upperdir/workdir of another mount, mount with '-o index=off' to override exclusive upperdir protection.
netlink: 28 bytes leftover after parsing attributes in process `syz-executor.2'.
nla_parse: 2 callbacks suppressed
netlink: 8 bytes leftover after parsing attributes in process `syz-executor.3'.
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.3'.
netlink: 8 bytes leftover after parsing attributes in process `syz-executor.3'.
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.3'.

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/11/22 05:23 linux-4.19.y 3f8a27f9e27b 4eb20a4e .config console log report info ci2-linux-4-19 possible deadlock in static_key_slow_dec
2021/11/21 15:01 linux-4.19.y 3f8a27f9e27b 4eb20a4e .config console log report info ci2-linux-4-19 possible deadlock in static_key_slow_dec
2021/10/04 21:45 linux-4.19.y c2276d585654 ce697b49 .config console log report info ci2-linux-4-19 possible deadlock in static_key_slow_dec
* Struck through repros no longer work on HEAD.