syzbot


possible deadlock in static_key_slow_dec (2)

Status: auto-closed as invalid on 2021/05/08 21:09
Reported-by: syzbot+2a13fd75b5be0f78259a@syzkaller.appspotmail.com
First crash: 836d, last: 752d
similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 possible deadlock in static_key_slow_dec (3) 3 435d 483d 0/1 auto-closed as invalid on 2022/03/22 05:24
upstream possible deadlock in static_key_slow_dec C done error 35 140d 1546d 0/24 auto-obsoleted due to no activity on 2023/01/11 02:59
linux-4.19 possible deadlock in static_key_slow_dec 1 1248d 1248d 0/1 auto-closed as invalid on 2019/12/30 04:27

Sample crash report:
bridge2: port 1(bridge_slave_0) entered blocking state
bridge2: port 1(bridge_slave_0) entered disabled state
F2FS-fs (loop4): Found nat_bits in checkpoint
device bridge_slave_0 entered promiscuous mode
======================================================
WARNING: possible circular locking dependency detected
4.19.165-syzkaller #0 Not tainted
mac80211_hwsim: wmediumd released netlink socket, switching to perfect channel medium
------------------------------------------------------
syz-executor.3/27688 is trying to acquire lock:
0000000029399654 (cpu_hotplug_lock.rw_sem){++++}, at: __static_key_slow_dec kernel/jump_label.c:212 [inline]
0000000029399654 (cpu_hotplug_lock.rw_sem){++++}, at: static_key_slow_dec+0x4f/0x90 kernel/jump_label.c:227

but task is already holding lock:
00000000ea5fb274 (&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){++++}:
       perf_copy_attr+0xab/0x7a0 kernel/events/core.c:10251
       _perf_ioctl+0x6aa/0x2300 kernel/events/core.c:5126
       perf_ioctl+0x55/0x80 kernel/events/core.c:5153
       vfs_ioctl fs/ioctl.c:46 [inline]
       file_ioctl fs/ioctl.c:501 [inline]
       do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
       ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
       __do_sys_ioctl fs/ioctl.c:712 [inline]
       __se_sys_ioctl fs/ioctl.c:710 [inline]
       __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
       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:11804
       perf_event_init+0x309/0x34e kernel/events/core.c:11851
       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:11798
       cpuhp_invoke_callback+0x201/0x1b80 kernel/cpu.c:169
       cpuhp_up_callbacks kernel/cpu.c:583 [inline]
       _cpu_up+0x257/0x510 kernel/cpu.c:1144
       do_cpu_up+0xdd/0x1b0 kernel/cpu.c:1179
       smp_init+0x1ed/0x202 kernel/smp.c:578
       kernel_init_freeable+0x60c/0xa98 init/main.c:1138
       kernel_init+0xd/0x1c0 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:289
       __static_key_slow_dec kernel/jump_label.c:212 [inline]
       static_key_slow_dec+0x4f/0x90 kernel/jump_label.c:227
       sw_perf_event_destroy+0x8a/0x120 kernel/events/core.c:8287
       _free_event+0x32c/0x1150 kernel/events/core.c:4460
       put_event kernel/events/core.c:4554 [inline]
       perf_mmap_close+0x6f6/0xea0 kernel/events/core.c:5558
       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:2326 [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.3/27688:
 #0: 00000000ea5fb274 (&mm->mmap_sem){++++}, at: vm_mmap_pgoff+0x152/0x200 mm/util.c:355

stack backtrace:
CPU: 1 PID: 27688 Comm: syz-executor.3 Not tainted 4.19.165-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/0x2fe lib/dump_stack.c:118
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1221
 check_prev_add kernel/locking/lockdep.c:1865 [inline]
 check_prevs_add kernel/locking/lockdep.c:1978 [inline]
 validate_chain kernel/locking/lockdep.c:2419 [inline]
 __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3415
 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3907
 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:289
 __static_key_slow_dec kernel/jump_label.c:212 [inline]
 static_key_slow_dec+0x4f/0x90 kernel/jump_label.c:227
 sw_perf_event_destroy+0x8a/0x120 kernel/events/core.c:8287
 _free_event+0x32c/0x1150 kernel/events/core.c:4460
 put_event kernel/events/core.c:4554 [inline]
 perf_mmap_close+0x6f6/0xea0 kernel/events/core.c:5558
 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:2326 [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:0x45e219
Code: 0d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 db b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f7d8e888c68 EFLAGS: 00000246 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 000000000045e219
RDX: 0000000000000000 RSI: 0000000000003000 RDI: 0000000020ffd000
RBP: 000000000119c128 R08: 0000000000000007 R09: 0000000000000000
R10: 0000000000000011 R11: 0000000000000246 R12: 000000000119c0dc
R13: 00007fff4839e90f R14: 00007f7d8e8899c0 R15: 000000000119c0dc
IPVS: ftp: loaded support on port[0] = 21
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.1'.
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.1'.
device bridge_slave_0 left promiscuous mode
bridge2: port 1(bridge_slave_0) entered disabled state
bridge3: port 1(bridge_slave_0) entered blocking state
bridge3: port 1(bridge_slave_0) entered disabled state
device bridge_slave_0 entered promiscuous mode
IPVS: ftp: loaded support on port[0] = 21
mac80211_hwsim: wmediumd released netlink socket, switching to perfect channel medium
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.1'.
device bridge_slave_0 left promiscuous mode
bridge3: port 1(bridge_slave_0) entered disabled state
bridge4: port 1(bridge_slave_0) entered blocking state
bridge4: port 1(bridge_slave_0) entered disabled state
device bridge_slave_0 entered promiscuous mode
f2fs_msg: 86 callbacks suppressed
F2FS-fs (loop0): sanity_check_inode: corrupted inode footer i_ino=3, ino,nid: [0, 3] run fsck to fix.
F2FS-fs (loop0): Failed to read root inode
F2FS-fs (loop4): inconsistent node block, nid:3, node_footer[nid:0,ino:0,ofs:0,cpver:0,blkaddr:0]
F2FS-fs (loop4): Failed to read root inode
F2FS-fs (loop4): invalid crc value
F2FS-fs (loop4): Found nat_bits in checkpoint
F2FS-fs (loop4): inconsistent node block, nid:3, node_footer[nid:0,ino:0,ofs:0,cpver:0,blkaddr:0]
F2FS-fs (loop4): Failed to read root inode
F2FS-fs (loop0): invalid crc value
F2FS-fs (loop0): Found nat_bits in checkpoint
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.1'.
device bridge_slave_0 left promiscuous mode
bridge4: port 1(bridge_slave_0) entered disabled state
bridge5: port 1(bridge_slave_0) entered blocking state
bridge5: port 1(bridge_slave_0) entered disabled state
device bridge_slave_0 entered promiscuous mode
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.1'.
device bridge_slave_0 left promiscuous mode
bridge5: port 1(bridge_slave_0) entered disabled state
bridge6: port 1(bridge_slave_0) entered blocking state
bridge6: port 1(bridge_slave_0) entered disabled state
device bridge_slave_0 entered promiscuous mode
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.1'.
9pnet: Insufficient options for proto=fd
device bridge_slave_0 left promiscuous mode
bridge6: port 1(bridge_slave_0) entered disabled state
9pnet: Insufficient options for proto=fd
bridge7: port 1(bridge_slave_0) entered blocking state
bridge7: port 1(bridge_slave_0) entered disabled state
device bridge_slave_0 entered promiscuous mode
9pnet: Insufficient options for proto=fd
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.1'.
device bridge_slave_0 left promiscuous mode
bridge7: port 1(bridge_slave_0) entered disabled state
bridge8: port 1(bridge_slave_0) entered blocking state
bridge8: port 1(bridge_slave_0) entered disabled state
device bridge_slave_0 entered promiscuous mode
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.1'.
device bridge_slave_0 left promiscuous mode
bridge8: port 1(bridge_slave_0) entered disabled state
bridge9: port 1(bridge_slave_0) entered blocking state
bridge9: port 1(bridge_slave_0) entered disabled state
f2fs_msg: 105 callbacks suppressed
F2FS-fs (loop0): inconsistent node block, nid:3, node_footer[nid:0,ino:0,ofs:0,cpver:0,blkaddr:0]
F2FS-fs (loop4): sanity_check_inode: corrupted inode footer i_ino=3, ino,nid: [0, 3] run fsck to fix.
device bridge_slave_0 entered promiscuous mode
F2FS-fs (loop0): Failed to read root inode
F2FS-fs (loop4): Failed to read root inode
F2FS-fs (loop0): invalid crc value
F2FS-fs (loop0): Found nat_bits in checkpoint
F2FS-fs (loop0): inconsistent node block, nid:3, node_footer[nid:0,ino:0,ofs:0,cpver:0,blkaddr:0]
F2FS-fs (loop0): Failed to read root inode
F2FS-fs (loop4): invalid crc value
F2FS-fs (loop4): Found nat_bits in checkpoint
9pnet: Insufficient options for proto=fd

Crashes (2):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci2-linux-4-19 2021/01/08 21:08 linux-4.19.y 4143d798313f c104d4a3 .config console log report info
ci2-linux-4-19 2020/10/16 22:04 linux-4.19.y a1b977b49b66 6e262c73 .config console log report info
* Struck through repros no longer work on HEAD.