witness: acquiring duplicate lock of same type: "&sc->sc_lock" 1st wsmuxlk @ /syzkaller/managers/multicore/kernel/sys/dev/wscons/wsmux.c:626 2nd wsmuxlk @ /syzkaller/managers/multicore/kernel/sys/dev/wscons/wsmux.c:242 Starting stack trace... witness_checkorder(ffff800000026dd0,1,ffffffff81f354ca,f2,0) at witness_checkorder+0xe14 witness_debugger sys/kern/subr_witness.c:2650 [inline] witness_checkorder(ffff800000026dd0,1,ffffffff81f354ca,f2,0) at witness_checkorder+0xe14 sys/kern/subr_witness.c:926 _rw_enter_read(ffff800000026dc0,ffffffff81f354ca,f2) at _rw_enter_read+0x80 sys/kern/kern_rwlock.c:102 wsmux_mux_open(ffff800000026d00,ffff800001994950) at wsmux_mux_open+0x82 wsmux_do_open sys/dev/wscons/wsmux.c:243 [inline] wsmux_mux_open(ffff800000026d00,ffff800001994950) at wsmux_mux_open+0x82 sys/dev/wscons/wsmux.c:225 wsmux_attach_sc(ffff800001994900,ffff800000026d00) at wsmux_attach_sc+0x180 sys/dev/wscons/wsmux.c:667 VOP_IOCTL(fffffd80705d8898,80085761,ffff800020c5f770,82,fffffd807f7c7cc0,ffff800020b43c38) at VOP_IOCTL+0x9a sys/kern/vfs_vops.c:290 vn_ioctl(fffffd806cf57730,80085761,ffff800020c5f770,ffff800020b43c38) at vn_ioctl+0xc9 sys/kern/vfs_vnops.c:512 sys_ioctl(ffff800020b43c38,ffff800020c5f8b8,ffff800020c5f8a0) at sys_ioctl+0x646 syscall(ffff800020c5f950) at syscall+0x5ac mi_syscall sys/sys/syscall_mi.h:99 [inline] syscall(ffff800020c5f950) at syscall+0x5ac sys/arch/amd64/amd64/trap.c:574 Xsyscall(6,0,ffffffffffffff86,0,3,20af5fb8010) at Xsyscall+0x128 end of kernel end trace frame: 0x20d421c6440, 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(ffff800000026dd0,1,ffffffff81f354ca,f2,0) at witness_checkorder+0xe19 witness_debugger sys/kern/subr_witness.c:2650 [inline] witness_checkorder(ffff800000026dd0,1,ffffffff81f354ca,f2,0) at witness_checkorder+0xe19 sys/kern/subr_witness.c:926 _rw_enter_read(ffff800000026dc0,ffffffff81f354ca,f2) at _rw_enter_read+0x80 sys/kern/kern_rwlock.c:102 wsmux_mux_open(ffff800000026d00,ffff800001994950) at wsmux_mux_open+0x82 wsmux_do_open sys/dev/wscons/wsmux.c:243 [inline] wsmux_mux_open(ffff800000026d00,ffff800001994950) at wsmux_mux_open+0x82 sys/dev/wscons/wsmux.c:225 wsmux_attach_sc(ffff800001994900,ffff800000026d00) at wsmux_attach_sc+0x180 sys/dev/wscons/wsmux.c:667 VOP_IOCTL(fffffd80705d8898,80085761,ffff800020c5f770,82,fffffd807f7c7cc0,ffff800020b43c38) at VOP_IOCTL+0x9a sys/kern/vfs_vops.c:290 vn_ioctl(fffffd806cf57730,80085761,ffff800020c5f770,ffff800020b43c38) at vn_ioctl+0xc9 sys/kern/vfs_vnops.c:512 sys_ioctl(ffff800020b43c38,ffff800020c5f8b8,ffff800020c5f8a0) at sys_ioctl+0x646 syscall(ffff800020c5f950) at syscall+0x5ac mi_syscall sys/sys/syscall_mi.h:99 [inline] syscall(ffff800020c5f950) at syscall+0x5ac sys/arch/amd64/amd64/trap.c:574 Xsyscall(6,0,ffffffffffffff86,0,3,20af5fb8010) at Xsyscall+0x128 end of kernel end trace frame: 0x20d421c6440, count: -10 ddb{1}> show registers rdi 0 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800020c5f3a0 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800003b49000 rax 0xffff800000021ec0 r8 0xffffffff81316553 kprintf+0x183 r9 0x1 r10 0x25 r11 0xd4c154f8b8613d r12 0xffffffff81f354ca substchar+0x955e r13 0xf2 r14 0xffffffff81f25297 apollo_udma33_tim+0x16e4 r15 0xffffffff81f354ca substchar+0x955e rip 0xffffffff81264218 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800020c5f390 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.0) pid=464912 stat=onproc flags process=0 proc=4000000 pri=76, usrpri=76, nice=20 forw=0xffffffffffffffff, list=0xffff800020b43530,0xffff800020b439f0 process=0xffff800020b44010 user=0xffff800020c5a000, vmspace=0xfffffd807f00d870 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 81623 258642 16393 0 2 0 syz-executor.0 *81623 464912 16393 0 7 0x4000000 syz-executor.0 40194 126515 53755 0 7 0 syz-executor.1 40194 131453 53755 0 3 0x4000080 fsleep syz-executor.1 40194 320487 53755 0 3 0x4000080 fsleep syz-executor.1 16393 29987 33335 0 3 0x82 nanosleep syz-executor.0 20383 442178 0 0 3 0x14200 bored sosplice 53755 1404 33335 0 3 0x82 nanosleep syz-executor.1 33335 220718 2062 0 3 0x82 thrsleep syz-fuzzer 33335 3709 2062 0 3 0x4000082 thrsleep syz-fuzzer 33335 358481 2062 0 3 0x4000082 thrsleep syz-fuzzer 33335 228450 2062 0 3 0x4000082 thrsleep syz-fuzzer 33335 307934 2062 0 3 0x4000082 thrsleep syz-fuzzer 33335 231434 2062 0 3 0x4000082 kqread syz-fuzzer 33335 291167 2062 0 3 0x4000082 thrsleep syz-fuzzer 33335 69268 2062 0 3 0x4000082 thrsleep syz-fuzzer 33335 243581 2062 0 3 0x4000082 thrsleep syz-fuzzer 33335 352371 2062 0 3 0x4000082 thrsleep syz-fuzzer 2062 73225 75688 0 3 0x10008a pause ksh 75688 435977 45270 0 3 0x92 select sshd 32094 231287 1 0 3 0x100083 ttyin getty 45270 360042 1 0 3 0x80 select sshd 78047 220702 13245 73 2 0x100090 syslogd 13245 380706 1 0 3 0x100082 netio syslogd 17871 326861 1 77 3 0x100090 poll dhclient 5019 145921 1 0 3 0x80 poll dhclient 56640 21232 0 0 2 0x14200 zerothread 82656 168550 0 0 3 0x14200 aiodoned aiodoned 34021 77769 0 0 3 0x14200 syncer update 65079 274787 0 0 3 0x14200 cleaner cleaner 99685 264719 0 0 3 0x14200 reaper reaper 82368 120104 0 0 3 0x14200 pgdaemon pagedaemon 4628 74603 0 0 3 0x14200 bored crynlk 51546 456967 0 0 3 0x14200 bored crypto 14365 266554 0 0 3 0x40014200 acpi0 acpi0 28349 511979 0 0 3 0x40014200 idle1 34997 317967 0 0 3 0x14200 bored softnet 66845 49910 0 0 3 0x14200 bored systqmp 7817 256931 0 0 3 0x14200 bored systq 10323 284595 0 0 3 0x40014200 bored softclock 6824 292449 0 0 3 0x40014200 idle0 1 176686 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 81623 (syz-executor.0) thread 0xffff800020b43c38 (464912) exclusive rwlock wsmuxlk r = 0 (0xffff8000019949d0) locked @ /syzkaller/managers/multicore/kernel/sys/dev/wscons/wsmux.c:626 #0 witness_lock+0x58a sys/kern/subr_witness.c:1205 #1 wsmux_attach_sc+0x48 sys/dev/wscons/wsmux.c:632 #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 (0xffffffff8235c720) 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 ddb{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim Kern Lim devbuf 9489 6346K 6348K 78643K 10681 0 0 pcb 23 9K 10K 78643K 251 0 0 rtable 100 3K 4K 78643K 233 0 0 ifaddr 46 11K 12K 78643K 67 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 2K 78643K 16 0 0 iov 0 0K 16K 78643K 26 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1199 75K 75K 78643K 1465 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 8 0 0 VM map 2 1K 1K 78643K 2 0 0 sem 12 1K 1K 78643K 54 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1792 194K 288K 78643K 12592 0 0 file desc 6 17K 21K 78643K 413 0 0 sigio 0 0K 0K 78643K 11 0 0 proc 42 38K 58K 78643K 316 0 0 subproc 64 65538K 67586K 78643K 102 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 54 0 0 in_multi 33 2K 2K 78643K 60 0 0 ether_multi 1 0K 0K 78643K 4 0 0 mrt 0 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 72 318K 318K 78643K 72 0 0 exec 0 0K 1K 78643K 190 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 86 20K 29K 78643K 2124 0 0 UVM aobj 23 2K 4K 78643K 27 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 25 0 0 NDP 8 0K 0K 78643K 19 0 0 temp 116 2356K 2424K 78643K 3859 0 0 kqueue 0 0K 0K 78643K 3 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 5 0 1 1 0 1 1 0 8 0 inpcbpl 280 227 0 220 1 0 1 1 0 8 0 plimitpl 152 20 0 13 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtentry 112 50 0 10 2 0 2 2 0 8 0 syncache 264 4 0 4 1 1 0 1 0 8 0 tcpcb 544 86 0 82 1 0 1 1 0 8 0 nd6 48 6 0 2 1 0 1 1 0 8 0 ppxss 1128 3 0 3 2 1 1 1 0 8 1 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 227 0 41 12 0 12 12 0 8 0 art_table 32 228 0 41 2 0 2 2 0 8 0 art_node 16 49 0 15 1 0 1 1 0 8 0 sysvmsgpl 40 14 0 8 1 0 1 1 0 8 0 semupl 112 1 0 1 1 1 0 1 0 8 0 semapl 112 49 0 39 1 0 1 1 0 8 0 shmpl 112 25 0 4 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 2187 0 780 46 0 46 46 0 8 0 ffsino 272 2187 0 780 95 0 95 95 0 8 0 nchpl 144 2996 0 1398 61 0 61 61 0 8 0 uvmvnodes 72 2284 0 0 42 0 42 42 0 8 0 vnodes 200 2284 0 0 121 0 121 121 0 8 0 namei 1024 8063 0 8063 2 1 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scsiplug 64 2 0 2 1 0 1 1 0 8 1 scxspl 192 7661 0 7661 7 6 1 6 0 8 1 sigapl 432 578 0 564 2 0 2 2 0 8 0 futexpl 56 4383 0 4381 1 0 1 1 0 8 0 knotepl 112 142 0 115 2 1 1 2 0 8 0 kqueuepl 104 95 0 93 1 0 1 1 0 8 0 pipepl 112 436 0 415 3 2 1 2 0 8 0 fdescpl 488 579 0 564 3 1 2 3 0 8 0 filepl 152 3465 0 3366 5 0 5 5 0 8 1 lockfpl 104 127 0 126 2 1 1 1 0 8 0 lockfspl 32 179 0 178 2 1 1 1 0 8 0 sessionpl 112 18 0 8 1 0 1 1 0 8 0 pgrppl 48 22 0 12 1 0 1 1 0 8 0 ucredpl 96 814 0 807 1 0 1 1 0 8 0 zombiepl 144 564 0 564 2 1 1 1 0 8 1 processpl 840 594 0 564 4 0 4 4 0 8 0 procpl 600 1515 0 1473 4 0 4 4 0 8 0 srpgc 64 6 0 6 1 1 0 1 0 8 0 sosppl 128 2 0 2 1 0 1 1 0 8 1 sockpl 384 430 0 413 3 0 3 3 0 8 1 mcl64k 65536 272 0 0 34 3 31 34 0 8 1 mcl16k 16384 1 0 0 1 0 1 1 0 8 0 mcl12k 12288 6 0 0 1 0 1 1 0 8 0 mcl9k 9216 4 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 mcl2k2 2112 2 0 0 1 0 1 1 0 8 0 mcl2k 2048 117 0 0 14 0 14 14 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 348 0 0 21 0 21 21 0 8 0 bufpl 256 6045 0 1020 315 0 315 315 0 8 0 anonpl 16 66685 0 58998 57 18 39 47 0 125 7 amapchunkpl 152 3633 0 3531 16 7 9 9 0 158 4 amappl16 192 2409 0 2011 33 13 20 32 0 8 0 amappl15 184 9 0 8 2 1 1 1 0 8 0 amappl14 176 7 0 5 2 1 1 1 0 8 0 amappl13 168 28 0 25 1 0 1 1 0 8 0 amappl12 160 218 0 214 2 1 1 1 0 8 0 amappl11 152 369 0 357 1 0 1 1 0 8 0 amappl10 144 52 0 52 2 2 0 1 0 8 0 amappl9 136 542 0 538 1 0 1 1 0 8 0 amappl8 128 347 0 324 1 0 1 1 0 8 0 amappl7 120 40 0 33 1 0 1 1 0 8 0 amappl6 112 53 0 47 1 0 1 1 0 8 0 amappl5 104 111 0 99 1 0 1 1 0 8 0 amappl4 96 271 0 249 1 0 1 1 0 8 0 amappl3 88 146 0 140 1 0 1 1 0 8 0 amappl2 80 4467 0 4406 2 0 2 2 0 8 0 amappl1 72 20658 0 20214 24 14 10 19 0 8 0 amappl 72 1740 0 1701 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 26 0 4 1 0 1 1 0 8 0 uaddrrnd 24 579 0 564 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 579 0 564 1 0 1 1 0 8 0 vmmpekpl 168 8711 0 8684 2 0 2 2 0 8 0 vmmpepl 168 67609 0 66166 91 27 64 73 0 357 1 vmsppl 360 578 0 564 2 0 2 2 0 8 0 pdppl 4096 1165 0 1128 5 0 5 5 0 8 0 pvpl 32 205547 0 194807 137 31 106 121 0 265 17 pmappl 224 578 0 564 1 0 1 1 0 8 0 extentpl 40 39 0 25 1 0 1 1 0 8 0 phpool 112 508 0 6 15 0 15 15 0 8 0