witness: acquiring duplicate lock of same type: "&sc->sc_lock" 1st wsmuxlk @ /syzkaller/managers/multicore/kernel/sys/dev/wscons/wsmux.c:522 2nd wsmuxlk @ /syzkaller/managers/multicore/kernel/sys/dev/wscons/wsmux.c:522 Starting stack trace... witness_checkorder(ffff800000026fd0,1,ffffffff81f36129,20a,0) at witness_checkorder+0xe14 witness_debugger sys/kern/subr_witness.c:2650 [inline] witness_checkorder(ffff800000026fd0,1,ffffffff81f36129,20a,0) at witness_checkorder+0xe14 sys/kern/subr_witness.c:926 _rw_enter_read(ffff800000026fc0,ffffffff81f36129,20a) at _rw_enter_read+0x80 sys/kern/kern_rwlock.c:102 wsmux_do_ioctl(ffff800000026f00,c058574e,ffff800020c42de0,3,ffff800020b43530) at wsmux_do_ioctl+0x4ef wsmux_do_ioctl(ffff800000026d00,c058574e,ffff800020c42de0,3,ffff800020b43530) at wsmux_do_ioctl+0x583 sys/dev/wscons/wsmux.c:531 VOP_IOCTL(fffffd8064d99870,c058574e,ffff800020c42de0,3,fffffd807f7c7b40,ffff800020b43530) at VOP_IOCTL+0x9a sys/kern/vfs_vops.c:290 vn_ioctl(fffffd8071d4ed28,c058574e,ffff800020c42de0,ffff800020b43530) at vn_ioctl+0xc9 sys/kern/vfs_vnops.c:512 sys_ioctl(ffff800020b43530,ffff800020c42f28,ffff800020c42f10) at sys_ioctl+0x646 syscall(ffff800020c42fc0) at syscall+0x5ac mi_syscall sys/sys/syscall_mi.h:99 [inline] syscall(ffff800020c42fc0) at syscall+0x5ac sys/arch/amd64/amd64/trap.c:574 Xsyscall(6,0,ffffffffffffff7c,0,3,d5ed1884010) at Xsyscall+0x128 end of kernel end trace frame: 0xd6173e9fec0, 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(ffff800000026fd0,1,ffffffff81f36129,20a,0) at witness_checkorder+0xe19 witness_debugger sys/kern/subr_witness.c:2650 [inline] witness_checkorder(ffff800000026fd0,1,ffffffff81f36129,20a,0) at witness_checkorder+0xe19 sys/kern/subr_witness.c:926 _rw_enter_read(ffff800000026fc0,ffffffff81f36129,20a) at _rw_enter_read+0x80 sys/kern/kern_rwlock.c:102 wsmux_do_ioctl(ffff800000026f00,c058574e,ffff800020c42de0,3,ffff800020b43530) at wsmux_do_ioctl+0x4ef wsmux_do_ioctl(ffff800000026d00,c058574e,ffff800020c42de0,3,ffff800020b43530) at wsmux_do_ioctl+0x583 sys/dev/wscons/wsmux.c:531 VOP_IOCTL(fffffd8064d99870,c058574e,ffff800020c42de0,3,fffffd807f7c7b40,ffff800020b43530) at VOP_IOCTL+0x9a sys/kern/vfs_vops.c:290 vn_ioctl(fffffd8071d4ed28,c058574e,ffff800020c42de0,ffff800020b43530) at vn_ioctl+0xc9 sys/kern/vfs_vnops.c:512 sys_ioctl(ffff800020b43530,ffff800020c42f28,ffff800020c42f10) at sys_ioctl+0x646 syscall(ffff800020c42fc0) at syscall+0x5ac mi_syscall sys/sys/syscall_mi.h:99 [inline] syscall(ffff800020c42fc0) at syscall+0x5ac sys/arch/amd64/amd64/trap.c:574 Xsyscall(6,0,ffffffffffffff7c,0,3,d5ed1884010) at Xsyscall+0x128 end of kernel end trace frame: 0xd6173e9fec0, count: -10 ddb{1}> show registers rdi 0 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800020c42990 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800002b4a000 rax 0xffff800001947ac0 r8 0xffffffff8155ffb3 kprintf+0x183 r9 0x1 r10 0x25 r11 0x6d1e3fd6f4627a55 r12 0xffffffff81f36129 substchar+0xb4b1 r13 0x20a r14 0xffffffff81f25d3f apollo_udma33_tim+0x233d r15 0xffffffff81f36129 substchar+0xb4b1 rip 0xffffffff812c7448 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800020c42980 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.1) pid=473321 stat=onproc flags process=0 proc=4000000 pri=69, usrpri=69, nice=20 forw=0xffffffffffffffff, list=0xffff800020b25520,0xffffffff8233fe30 process=0xffff800020b44d30 user=0xffff800020c3e000, vmspace=0xfffffd807efff168 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 44595 210427 2133 0 7 0 syz-executor.1 *44595 473321 2133 0 7 0x4000000 syz-executor.1 78917 510534 0 0 3 0x14200 bored sosplice 2133 260133 23650 0 3 0x82 nanosleep syz-executor.1 13190 108544 23650 0 3 0x2 biowait syz-executor.0 23650 481205 86616 0 3 0x82 thrsleep syz-fuzzer 23650 190782 86616 0 3 0x4000082 nanosleep syz-fuzzer 23650 517177 86616 0 3 0x4000082 thrsleep syz-fuzzer 23650 180069 86616 0 3 0x4000082 thrsleep syz-fuzzer 23650 322153 86616 0 3 0x4000082 thrsleep syz-fuzzer 23650 162738 86616 0 3 0x4000082 thrsleep syz-fuzzer 23650 65519 86616 0 3 0x4000082 thrsleep syz-fuzzer 23650 173409 86616 0 3 0x4000082 thrsleep syz-fuzzer 23650 509810 86616 0 3 0x4000082 kqread syz-fuzzer 23650 456468 86616 0 3 0x4000082 thrsleep syz-fuzzer 86616 19945 27731 0 3 0x10008a pause ksh 27731 83307 61790 0 3 0x92 select sshd 93791 243928 1 0 3 0x100083 ttyin getty 61790 515105 1 0 3 0x80 select sshd 19090 156913 28271 73 2 0x100090 syslogd 28271 11513 1 0 3 0x100082 netio syslogd 14943 85120 1 77 3 0x100090 poll dhclient 35545 28473 1 0 3 0x80 poll dhclient 21293 409672 0 0 3 0x14200 pgzero zerothread 14211 293708 0 0 3 0x14200 aiodoned aiodoned 51679 54464 0 0 3 0x14200 syncer update 46843 67703 0 0 3 0x14200 cleaner cleaner 90415 175807 0 0 3 0x14200 reaper reaper 39428 287921 0 0 3 0x14200 pgdaemon pagedaemon 39407 116063 0 0 3 0x14200 bored crynlk 38172 391923 0 0 3 0x14200 bored crypto 26318 493101 0 0 3 0x40014200 acpi0 acpi0 55431 12433 0 0 3 0x40014200 idle1 44710 217248 0 0 3 0x14200 bored softnet 49563 7048 0 0 3 0x14200 bored systqmp 80792 270101 0 0 3 0x14200 bored systq 89712 174680 0 0 3 0x40014200 bored softclock 9593 501232 0 0 3 0x40014200 idle0 1 120874 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 44595 (syz-executor.1) thread 0xffff800020b43530 (473321) shared rwlock wsmuxlk r = 0 (0xffff800000026dd0) locked @ /syzkaller/managers/multicore/kernel/sys/dev/wscons/wsmux.c:522 #0 witness_lock+0x58a sys/kern/subr_witness.c:1205 #1 wsmux_do_ioctl+0x4ef #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 (0xffffffff8230eba0) 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 13190 (syz-executor.0) thread 0xffff800020b24008 (108544) exclusive rrwlock inode r = 0 (0xfffffd8071c7a5f0) 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 vget+0x1b8 sys/kern/vfs_subr.c:672 #6 ufs_ihashget+0x151 sys/ufs/ufs/ufs_ihash.c:119 #7 ffs_vget+0x84 sys/ufs/ffs/ffs_vfsops.c:1323 #8 ufs_lookup+0x159c sys/ufs/ufs/ufs_lookup.c:487 #9 VOP_LOOKUP+0x67 sys/kern/vfs_vops.c:90 #10 vfs_lookup+0x556 sys/kern/vfs_lookup.c:523 #11 namei+0x4b2 sys/kern/vfs_lookup.c:224 #12 dounlinkat+0xa5 sys/kern/vfs_syscalls.c:1673 #13 syscall+0x5ac mi_syscall sys/sys/syscall_mi.h:99 [inline] #13 syscall+0x5ac sys/arch/amd64/amd64/trap.c:574 #14 Xsyscall+0x128 exclusive rrwlock inode r = 0 (0xfffffd8071c7ab40) 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 vget+0x1b8 sys/kern/vfs_subr.c:672 #6 cache_lookup+0x300 sys/kern/vfs_cache.c:224 #7 ufs_lookup+0x1d7 sys/ufs/ufs/ufs_lookup.c:162 #8 VOP_LOOKUP+0x67 sys/kern/vfs_vops.c:90 #9 vfs_lookup+0x556 sys/kern/vfs_lookup.c:523 #10 namei+0x4b2 sys/kern/vfs_lookup.c:224 #11 dounlinkat+0xa5 sys/kern/vfs_syscalls.c:1673 #12 syscall+0x5ac mi_syscall sys/sys/syscall_mi.h:99 [inline] #12 syscall+0x5ac sys/arch/amd64/amd64/trap.c:574 #13 Xsyscall+0x128 ddb{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim Kern Lim devbuf 9467 6339K 6344K 78643K 10597 0 0 pcb 23 9K 9K 78643K 105 0 0 rtable 100 3K 4K 78643K 191 0 0 ifaddr 39 10K 11K 78643K 52 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 2K 78643K 15 0 0 iov 0 0K 12K 78643K 15 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1199 75K 75K 78643K 1283 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 21 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1792 194K 288K 78643K 12592 0 0 file desc 5 13K 25K 78643K 155 0 0 sigio 0 0K 0K 78643K 4 0 0 proc 41 38K 58K 78643K 262 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 25 0 0 in_multi 33 2K 2K 78643K 36 0 0 ether_multi 1 0K 0K 78643K 1 0 0 ISOFS mount 1 32K 32K 78643K 1 0 0 MSDOSFS mount 1 16K 16K 78643K 1 0 0 ttys 48 212K 212K 78643K 48 0 0 exec 0 0K 1K 78643K 173 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 78 20K 20K 78643K 1204 0 0 UVM aobj 6 2K 2K 78643K 6 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 10 0 0 NDP 6 0K 0K 78643K 13 0 0 temp 91 2357K 2421K 78643K 3132 0 0 kqueue 0 0K 0K 78643K 4 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 106 0 99 1 0 1 1 0 8 0 plimitpl 152 15 0 8 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 39 0 35 1 0 1 1 0 8 0 nd6 48 4 0 0 1 0 1 1 0 8 0 ppxss 1128 3 0 3 1 0 1 1 0 8 1 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 semapl 112 19 0 9 1 0 1 1 0 8 0 shmpl 112 4 0 0 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 1702 0 297 46 0 46 46 0 8 0 ffsino 272 1702 0 297 95 0 95 95 0 8 0 nchpl 144 2126 0 503 61 0 61 61 0 8 0 uvmvnodes 72 1756 0 0 32 0 32 32 0 8 0 vnodes 200 1756 0 0 93 0 93 93 0 8 0 namei 1024 5273 0 5273 2 1 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 5746 0 5745 7 6 1 6 0 8 0 sigapl 432 323 0 310 2 0 2 2 0 8 0 futexpl 56 1699 0 1699 1 0 1 1 0 8 1 knotepl 112 92 0 65 2 1 1 2 0 8 0 kqueuepl 104 45 0 42 1 0 1 1 0 8 0 pipepl 112 170 0 151 2 1 1 1 0 8 0 fdescpl 488 324 0 310 3 1 2 3 0 8 0 filepl 152 1699 0 1601 5 0 5 5 0 8 1 lockfpl 104 82 0 82 2 1 1 1 0 8 1 lockfspl 32 54 0 54 2 1 1 1 0 8 1 sessionpl 112 17 0 7 1 0 1 1 0 8 0 pgrppl 48 17 0 7 1 0 1 1 0 8 0 ucredpl 96 221 0 214 1 0 1 1 0 8 0 zombiepl 144 310 0 310 2 1 1 1 0 8 1 processpl 840 339 0 310 4 0 4 4 0 8 0 procpl 600 636 0 597 4 0 4 4 0 8 0 sockpl 384 176 0 159 3 0 3 3 0 8 1 mcl64k 65536 3 0 0 1 0 1 1 0 8 0 mcl12k 12288 2 0 0 1 0 1 1 0 8 0 mcl9k 9216 3 0 0 1 0 1 1 0 8 0 mcl8k 8192 2 0 0 1 0 1 1 0 8 0 mcl4k 4096 4 0 0 1 0 1 1 0 8 0 mcl2k 2048 106 0 0 13 0 13 13 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 117 0 0 7 0 7 7 0 8 0 bufpl 256 5494 0 1019 280 0 280 280 0 8 0 anonpl 16 41374 0 33612 48 1 47 47 0 125 13 amapchunkpl 152 1440 0 1346 5 0 5 5 0 158 0 amappl16 192 1424 0 1022 32 0 32 32 0 8 10 amappl15 184 2 0 0 1 0 1 1 0 8 0 amappl14 176 6 0 4 2 1 1 1 0 8 0 amappl13 168 25 0 22 1 0 1 1 0 8 0 amappl12 160 151 0 147 1 0 1 1 0 8 0 amappl11 152 189 0 178 1 0 1 1 0 8 0 amappl10 144 53 0 52 2 1 1 1 0 8 0 amappl9 136 330 0 327 1 0 1 1 0 8 0 amappl8 128 268 0 250 1 0 1 1 0 8 0 amappl7 120 39 0 34 1 0 1 1 0 8 0 amappl6 112 51 0 45 1 0 1 1 0 8 0 amappl5 104 172 0 161 1 0 1 1 0 8 0 amappl4 96 271 0 245 2 1 1 2 0 8 0 amappl3 88 134 0 129 1 0 1 1 0 8 0 amappl2 80 1993 0 1942 2 0 2 2 0 8 0 amappl1 72 15048 0 14636 24 14 10 19 0 8 0 amappl 72 840 0 806 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 5 0 0 1 0 1 1 0 8 0 uaddrrnd 24 324 0 310 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 324 0 310 1 0 1 1 0 8 0 vmmpekpl 168 6259 0 6235 2 0 2 2 0 8 0 vmmpepl 168 42111 0 40783 89 17 72 72 0 357 11 vmsppl 360 323 0 310 2 0 2 2 0 8 0 pdppl 4096 656 0 620 6 1 5 6 0 8 0 pvpl 32 147301 0 136588 134 12 122 122 0 265 31 pmappl 224 323 0 310 1 0 1 1 0 8 0 extentpl 40 39 0 25 1 0 1 1 0 8 0 phpool 112 425 0 4 13 0 13 13 0 8 0