witness: acquiring duplicate lock of same type: "&sc->sc_lock" 1st wsmuxlk @ /syzkaller/managers/multicore/kernel/sys/dev/wscons/wsmux.c:629 2nd wsmuxlk @ /syzkaller/managers/multicore/kernel/sys/dev/wscons/wsmux.c:245 Starting stack trace... witness_checkorder(ffff80000196bbd0,1,ffffffff81f33463,f5,0) at witness_checkorder+0xe14 witness_debugger sys/kern/subr_witness.c:2650 [inline] witness_checkorder(ffff80000196bbd0,1,ffffffff81f33463,f5,0) at witness_checkorder+0xe14 sys/kern/subr_witness.c:926 _rw_enter_read(ffff80000196bbc0,ffffffff81f33463,f5) at _rw_enter_read+0x80 sys/kern/kern_rwlock.c:102 wsmux_mux_open(ffff80000196bb00,ffff800002b48350) at wsmux_mux_open+0x82 wsmux_do_open sys/dev/wscons/wsmux.c:246 [inline] wsmux_mux_open(ffff80000196bb00,ffff800002b48350) at wsmux_mux_open+0x82 sys/dev/wscons/wsmux.c:228 wsmux_attach_sc(ffff800002b48300,ffff80000196bb00) at wsmux_attach_sc+0x180 sys/dev/wscons/wsmux.c:670 VOP_IOCTL(fffffd8065098260,80085761,ffff800020c3ed90,f,fffffd807f7c78a0,ffff800020b439e0) at VOP_IOCTL+0x9a sys/kern/vfs_vops.c:290 vn_ioctl(fffffd8067243ad0,80085761,ffff800020c3ed90,ffff800020b439e0) at vn_ioctl+0xc9 sys/kern/vfs_vnops.c:512 sys_ioctl(ffff800020b439e0,ffff800020c3eed8,ffff800020c3eec0) at sys_ioctl+0x646 syscall(ffff800020c3ef70) at syscall+0x5ac mi_syscall sys/sys/syscall_mi.h:99 [inline] syscall(ffff800020c3ef70) at syscall+0x5ac sys/arch/amd64/amd64/trap.c:574 Xsyscall(6,0,ffffffffffffff86,0,3,358548d7010) at Xsyscall+0x128 end of kernel end trace frame: 0x35aaf596580, count: 248 End of stack trace. Stopped at db_enter+0x18: addq $0x8,%rsp ddb{1}> ddb{1}> set $lines = 0 ddb{1}> set $maxwidth = 0 ddb{1}> show panic the kernel did not panic ddb{1}> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:399 witness_checkorder(ffff80000196bbd0,1,ffffffff81f33463,f5,0) at witness_checkorder+0xe19 witness_debugger sys/kern/subr_witness.c:2650 [inline] witness_checkorder(ffff80000196bbd0,1,ffffffff81f33463,f5,0) at witness_checkorder+0xe19 sys/kern/subr_witness.c:926 _rw_enter_read(ffff80000196bbc0,ffffffff81f33463,f5) at _rw_enter_read+0x80 sys/kern/kern_rwlock.c:102 wsmux_mux_open(ffff80000196bb00,ffff800002b48350) at wsmux_mux_open+0x82 wsmux_do_open sys/dev/wscons/wsmux.c:246 [inline] wsmux_mux_open(ffff80000196bb00,ffff800002b48350) at wsmux_mux_open+0x82 sys/dev/wscons/wsmux.c:228 wsmux_attach_sc(ffff800002b48300,ffff80000196bb00) at wsmux_attach_sc+0x180 sys/dev/wscons/wsmux.c:670 VOP_IOCTL(fffffd8065098260,80085761,ffff800020c3ed90,f,fffffd807f7c78a0,ffff800020b439e0) at VOP_IOCTL+0x9a sys/kern/vfs_vops.c:290 vn_ioctl(fffffd8067243ad0,80085761,ffff800020c3ed90,ffff800020b439e0) at vn_ioctl+0xc9 sys/kern/vfs_vnops.c:512 sys_ioctl(ffff800020b439e0,ffff800020c3eed8,ffff800020c3eec0) at sys_ioctl+0x646 syscall(ffff800020c3ef70) at syscall+0x5ac mi_syscall sys/sys/syscall_mi.h:99 [inline] syscall(ffff800020c3ef70) at syscall+0x5ac sys/arch/amd64/amd64/trap.c:574 Xsyscall(6,0,ffffffffffffff86,0,3,358548d7010) at Xsyscall+0x128 end of kernel end trace frame: 0x35aaf596580, count: -10 ddb{1}> show registers rdi 0 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800020c3e9c0 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800002b49000 rax 0xffff800001b47c00 r8 0xffffffff818cb2f3 kprintf+0x183 r9 0x1 r10 0x25 r11 0x7fa40a62896b22db r12 0xffffffff81f33463 substchar+0x92c4 r13 0xf5 r14 0xffffffff81f22d40 cmd680_setup_channel.udma_tbl+0x3c0b r15 0xffffffff81f33463 substchar+0x92c4 rip 0xffffffff811a46a8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800020c3e9b0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.1) pid=49027 stat=onproc flags process=10 proc=4000000 pri=65, usrpri=65, nice=20 forw=0xffffffffffffffff, list=0xffff800020b43788,0xffff800020b42280 process=0xffff800020b45078 user=0xffff800020c3a000, vmspace=0xfffffd807effe2d0 estcpu=15, cpticks=23, pctcpu=0.78 user=0, sys=0, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 79087 162320 61271 0 7 0x10 syz-executor.1 *79087 49027 61271 0 7 0x4000010 syz-executor.1 79087 234034 61271 0 3 0x4000090 fsleep syz-executor.1 60369 512208 0 0 3 0x14200 bored sosplice 61271 129039 1052 0 3 0x82 nanosleep syz-executor.1 7227 431944 1052 0 3 0x2 biowait syz-executor.0 1052 432963 79257 0 3 0x82 thrsleep syz-fuzzer 1052 244642 79257 0 3 0x4000082 nanosleep syz-fuzzer 1052 414170 79257 0 3 0x4000082 thrsleep syz-fuzzer 1052 76756 79257 0 3 0x4000082 kqread syz-fuzzer 1052 389486 79257 0 3 0x4000082 thrsleep syz-fuzzer 1052 484961 79257 0 3 0x4000082 thrsleep syz-fuzzer 1052 109219 79257 0 3 0x4000082 thrsleep syz-fuzzer 1052 135403 79257 0 3 0x4000082 thrsleep syz-fuzzer 1052 476304 79257 0 3 0x4000082 thrsleep syz-fuzzer 1052 383461 79257 0 3 0x4000082 thrsleep syz-fuzzer 79257 395120 53843 0 3 0x10008a pause ksh 53843 80230 25867 0 3 0x92 select sshd 65045 359235 1 0 3 0x100083 ttyin getty 25867 278806 1 0 3 0x80 select sshd 89836 473623 78699 73 3 0x100010 ffs_fsync syslogd 78699 93242 1 0 3 0x100082 netio syslogd 96294 482660 1 77 3 0x100090 poll dhclient 3905 504729 1 0 3 0x80 poll dhclient 37940 132370 0 0 3 0x14200 pgzero zerothread 18844 241980 0 0 3 0x14200 aiodoned aiodoned 26134 406304 0 0 3 0x14200 syncer update 46474 472246 0 0 3 0x14200 cleaner cleaner 86806 207759 0 0 3 0x14200 reaper reaper 7251 435925 0 0 3 0x14200 pgdaemon pagedaemon 57995 227068 0 0 3 0x14200 bored crynlk 89014 274286 0 0 3 0x14200 bored crypto 7287 306120 0 0 3 0x40014200 acpi0 acpi0 49988 363865 0 0 3 0x40014200 idle1 1936 318298 0 0 3 0x14200 bored softnet 25043 323331 0 0 3 0x14200 bored systqmp 81369 503617 0 0 3 0x14200 bored systq 73503 485582 0 0 3 0x40014200 bored softclock 94872 453755 0 0 3 0x40014200 idle0 1 510589 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 79087 (syz-executor.1) thread 0xffff800020b439e0 (49027) exclusive rwlock wsmuxlk r = 0 (0xffff800002b483d0) locked @ /syzkaller/managers/multicore/kernel/sys/dev/wscons/wsmux.c:629 #0 witness_lock+0x58a sys/kern/subr_witness.c:1205 #1 wsmux_attach_sc+0x48 sys/dev/wscons/wsmux.c:635 #2 VOP_IOCTL+0x9a sys/kern/vfs_vops.c:290 #3 vn_ioctl+0xc9 sys/kern/vfs_vnops.c:512 #4 sys_ioctl+0x646 #5 syscall+0x5ac mi_syscall sys/sys/syscall_mi.h:99 [inline] #5 syscall+0x5ac sys/arch/amd64/amd64/trap.c:574 #6 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 0 (0xffffffff82360c40) locked @ /syzkaller/managers/multicore/kernel/sys/sys/syscall_mi.h:90 #0 witness_lock+0x58a sys/kern/subr_witness.c:1205 #1 syscall+0x47f mi_syscall sys/sys/syscall_mi.h:91 [inline] #1 syscall+0x47f sys/arch/amd64/amd64/trap.c:574 #2 Xsyscall+0x128 Process 7227 (syz-executor.0) thread 0xffff800020b24968 (431944) exclusive rrwlock inode r = 0 (0xfffffd80743652c0) locked @ /syzkaller/managers/multicore/kernel/sys/ufs/ufs/ufs_ihash.c:140 #0 witness_lock+0x58a sys/kern/subr_witness.c:1205 #1 _rw_enter+0x44d sys/kern/kern_rwlock.c:280 #2 _rrw_enter+0x60 sys/kern/kern_rwlock.c:410 #3 ufs_ihashins+0x67 sys/ufs/ufs/ufs_ihash.c:140 #4 ffs_vget+0x13d sys/ufs/ffs/ffs_vfsops.c:1352 #5 ffs_inode_alloc+0x1c3 sys/ufs/ffs/ffs_alloc.c:392 #6 ufs_mkdir+0x10f sys/ufs/ufs/ufs_vnops.c:1164 #7 VOP_MKDIR+0x76 sys/kern/vfs_vops.c:449 #8 domkdirat+0x12d sys/kern/vfs_syscalls.c:2881 #9 syscall+0x5ac mi_syscall sys/sys/syscall_mi.h:99 [inline] #9 syscall+0x5ac sys/arch/amd64/amd64/trap.c:574 #10 Xsyscall+0x128 exclusive rrwlock inode r = 0 (0xfffffd806a1f6098) locked @ /syzkaller/managers/multicore/kernel/sys/ufs/ufs/ufs_vnops.c:1547 #0 witness_lock+0x58a sys/kern/subr_witness.c:1205 #1 _rw_enter+0x44d sys/kern/kern_rwlock.c:280 #2 _rrw_enter+0x60 sys/kern/kern_rwlock.c:410 #3 VOP_LOCK+0x57 sys/kern/vfs_vops.c:602 #4 vn_lock+0x6e sys/kern/vfs_vnops.c:549 #5 vfs_lookup+0xf5 sys/kern/vfs_lookup.c:387 #6 namei+0x4b2 sys/kern/vfs_lookup.c:224 #7 domkdirat+0x81 sys/kern/vfs_syscalls.c:2866 #8 syscall+0x5ac mi_syscall sys/sys/syscall_mi.h:99 [inline] #8 syscall+0x5ac sys/arch/amd64/amd64/trap.c:574 #9 Xsyscall+0x128 Process 89836 (syslogd) thread 0xffff800020b959d8 (473623) exclusive rrwlock inode r = 0 (0xfffffd806ebcc1a8) locked @ /syzkaller/managers/multicore/kernel/sys/ufs/ufs/ufs_vnops.c:1547 #0 witness_lock+0x58a sys/kern/subr_witness.c:1205 #1 _rw_enter+0x44d sys/kern/kern_rwlock.c:280 #2 _rrw_enter+0x60 sys/kern/kern_rwlock.c:410 #3 VOP_LOCK+0x57 sys/kern/vfs_vops.c:602 #4 vn_lock+0x6e sys/kern/vfs_vnops.c:549 #5 sys_fsync+0x114 sys/kern/vfs_syscalls.c:2704 #6 syscall+0x5ac mi_syscall sys/sys/syscall_mi.h:99 [inline] #6 syscall+0x5ac sys/arch/amd64/amd64/trap.c:574 #7 Xsyscall+0x128 ddb{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim Kern Lim devbuf 9486 14541K 14541K 78643K 10630 0 0 pcb 23 9K 11K 78643K 105 0 0 rtable 100 3K 4K 78643K 184 0 0 ifaddr 45 11K 11K 78643K 50 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 2K 78643K 19 0 0 iov 0 0K 20K 78643K 21 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1206 76K 76K 78643K 1347 0 0 UFS quota 1 32K 32K 78643K 1 0 0 UFS mount 5 36K 36K 78643K 5 0 0 shm 2 1K 5K 78643K 4 0 0 VM map 2 1K 1K 78643K 2 0 0 sem 12 0K 0K 78643K 26 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1792 194K 288K 78643K 12592 0 0 file desc 5 13K 21K 78643K 198 0 0 sigio 0 0K 0K 78643K 2 0 0 proc 42 38K 70K 78643K 279 0 0 subproc 64 65538K 67586K 78643K 68 0 0 NFS srvsock 1 0K 0K 78643K 1 0 0 NFS daemon 1 16K 16K 78643K 1 0 0 ip_moptions 0 0K 0K 78643K 24 0 0 in_multi 33 2K 2K 78643K 44 0 0 ether_multi 1 0K 0K 78643K 3 0 0 ISOFS mount 1 32K 32K 78643K 1 0 0 MSDOSFS mount 1 16K 16K 78643K 1 0 0 ttys 54 238K 238K 78643K 54 0 0 exec 0 0K 1K 78643K 181 0 0 pagedep 1 8K 8K 78643K 1 0 0 inodedep 1 32K 32K 78643K 1 0 0 newblk 1 0K 0K 78643K 1 0 0 VM swap 7 26K 26K 78643K 7 0 0 UVM amap 79 20K 20K 78643K 1383 0 0 UVM aobj 17 2K 2K 78643K 17 0 0 memdesc 1 4K 4K 78643K 1 0 0 crypto data 1 1K 1K 78643K 1 0 0 ip6_options 0 0K 0K 78643K 6 0 0 NDP 8 0K 0K 78643K 13 0 0 temp 115 2360K 2424K 78643K 3245 0 0 SYN cache 2 16K 16K 78643K 2 0 0 ddb{1}> show all pools Name Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle arp 64 4 0 0 1 0 1 1 0 8 0 inpcbpl 280 127 0 120 1 0 1 1 0 8 0 plimitpl 152 17 0 10 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtentry 112 41 0 1 2 0 2 2 0 8 0 syncache 264 4 0 4 1 1 0 1 0 8 0 tcpcb 544 47 0 43 1 0 1 1 0 8 0 nd6 48 4 0 0 1 0 1 1 0 8 0 ppxss 1128 1 0 1 1 1 0 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 185 0 0 12 0 12 12 0 8 0 art_table 32 186 0 0 2 0 2 2 0 8 0 art_node 16 40 0 6 1 0 1 1 0 8 0 sysvmsgpl 40 2 0 0 1 0 1 1 0 8 0 semapl 112 24 0 14 1 0 1 1 0 8 0 shmpl 112 15 0 0 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 1783 0 376 46 0 46 46 0 8 0 ffsino 272 1783 0 376 95 0 95 95 0 8 0 nchpl 144 2265 0 644 61 0 61 61 0 8 0 uvmvnodes 72 1857 0 0 34 0 34 34 0 8 0 vnodes 200 1857 0 0 98 0 98 98 0 8 0 namei 1024 5781 0 5780 2 1 1 1 0 8 0 percpumem 16 30 0 0 1 0 1 1 0 8 0 scsiplug 64 1 0 1 1 0 1 1 0 8 1 scxspl 192 6610 0 6608 12 9 3 6 0 8 2 sigapl 432 366 0 353 2 0 2 2 0 8 0 futexpl 56 2068 0 2067 1 0 1 1 0 8 0 knotepl 112 87 0 60 2 1 1 2 0 8 0 kqueuepl 104 38 0 36 1 0 1 1 0 8 0 pipepl 112 222 0 203 2 1 1 1 0 8 0 fdescpl 488 367 0 353 3 1 2 3 0 8 0 filepl 152 2049 0 1954 7 2 5 5 0 8 1 lockfpl 104 84 0 84 2 1 1 1 0 8 1 lockfspl 32 152 0 152 2 1 1 1 0 8 1 sessionpl 112 17 0 7 1 0 1 1 0 8 0 pgrppl 48 19 0 9 1 0 1 1 0 8 0 ucredpl 96 449 0 441 1 0 1 1 0 8 0 zombiepl 144 353 0 353 2 1 1 1 0 8 1 processpl 840 382 0 353 4 0 4 4 0 8 0 procpl 600 807 0 767 4 0 4 4 0 8 0 sosppl 128 7 0 7 1 1 0 1 0 8 0 sockpl 384 207 0 190 5 2 3 4 0 8 1 mcl64k 65536 3 0 0 1 0 1 1 0 8 0 mcl16k 16384 1 0 0 1 0 1 1 0 8 0 mcl12k 12288 2 0 0 1 0 1 1 0 8 0 mcl9k 9216 1 0 0 1 0 1 1 0 8 0 mcl4k 4096 4 0 0 1 0 1 1 0 8 0 mcl2k2 2112 1 0 0 1 0 1 1 0 8 0 mcl2k 2048 113 0 0 14 0 14 14 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 128 0 0 8 0 8 8 0 8 0 bufpl 256 5956 0 1015 309 0 309 309 0 8 0 anonpl 16 43627 0 35983 50 2 48 48 0 125 15 amapchunkpl 152 1808 0 1718 6 1 5 5 0 158 1 amappl16 192 1487 0 1086 32 4 28 32 0 8 7 amappl15 184 91 0 89 1 0 1 1 0 8 0 amappl14 176 98 0 96 2 1 1 1 0 8 0 amappl13 168 25 0 22 1 0 1 1 0 8 0 amappl12 160 8 0 7 1 0 1 1 0 8 0 amappl11 152 267 0 257 1 0 1 1 0 8 0 amappl10 144 54 0 52 1 0 1 1 0 8 0 amappl9 136 429 0 423 1 0 1 1 0 8 0 amappl8 128 135 0 116 1 0 1 1 0 8 0 amappl7 120 37 0 32 1 0 1 1 0 8 0 amappl6 112 56 0 48 1 0 1 1 0 8 0 amappl5 104 239 0 227 1 0 1 1 0 8 0 amappl4 96 271 0 247 2 1 1 2 0 8 0 amappl3 88 133 0 127 1 0 1 1 0 8 0 amappl2 80 2425 0 2375 2 0 2 2 0 8 0 amappl1 72 16235 0 15829 23 13 10 19 0 8 0 amappl 72 1023 0 988 1 0 1 1 0 75 0 dma4096 4096 1 0 1 1 1 0 1 0 8 0 dma256 256 6 0 6 1 1 0 1 0 8 0 dma64 64 259 0 259 1 1 0 1 0 8 0 dma32 32 7 0 7 1 1 0 1 0 8 0 dma16 16 17 0 17 1 1 0 1 0 8 0 aobjpl 64 16 0 0 1 0 1 1 0 8 0 uaddrrnd 24 367 0 353 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 367 0 353 1 0 1 1 0 8 0 vmmpekpl 168 6778 0 6757 2 0 2 2 0 8 0 vmmpepl 168 46548 0 45224 85 16 69 70 0 357 9 vmsppl 360 366 0 353 2 0 2 2 0 8 0 pdppl 4096 742 0 706 6 1 5 6 0 8 0 pvpl 32 157303 0 146208 130 11 119 119 0 265 29 pmappl 224 366 0 353 1 0 1 1 0 8 0 extentpl 40 39 0 25 1 0 1 1 0 8 0 phpool 112 456 0 4 13 0 13 13 0 8 0