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(ffff80000069e8d0,1,ffffffff81f33463,f5,0) at witness_checkorder+0xe14 witness_debugger sys/kern/subr_witness.c:2650 [inline] witness_checkorder(ffff80000069e8d0,1,ffffffff81f33463,f5,0) at witness_checkorder+0xe14 sys/kern/subr_witness.c:926 _rw_enter_read(ffff80000069e8c0,ffffffff81f33463,f5) at _rw_enter_read+0x80 sys/kern/kern_rwlock.c:102 wsmux_mux_open(ffff80000069e800,ffff800000026d50) at wsmux_mux_open+0x82 wsmux_do_open sys/dev/wscons/wsmux.c:246 [inline] wsmux_mux_open(ffff80000069e800,ffff800000026d50) at wsmux_mux_open+0x82 sys/dev/wscons/wsmux.c:228 wsmux_attach_sc(ffff800000026d00,ffff80000069e800) at wsmux_attach_sc+0x180 sys/dev/wscons/wsmux.c:670 VOP_IOCTL(fffffd8071d9ee48,80085761,ffff800020c14dc0,c7,fffffd807f7c7a20,ffff800020b42bd0) at VOP_IOCTL+0x9a sys/kern/vfs_vops.c:290 vn_ioctl(fffffd80671f30b8,80085761,ffff800020c14dc0,ffff800020b42bd0) at vn_ioctl+0xc9 sys/kern/vfs_vnops.c:512 sys_ioctl(ffff800020b42bd0,ffff800020c14f08,ffff800020c14ef0) at sys_ioctl+0x646 syscall(ffff800020c14fa0) at syscall+0x5ac mi_syscall sys/sys/syscall_mi.h:99 [inline] syscall(ffff800020c14fa0) at syscall+0x5ac sys/arch/amd64/amd64/trap.c:574 Xsyscall(6,0,ffffffffffffff86,0,3,d25e7902010) at Xsyscall+0x128 end of kernel end trace frame: 0xd28a60160d0, count: 248 End of stack trace. Stopped at db_enter+0x18: addq $0x8,%rsp ddb{0}> ddb{0}> set $lines = 0 ddb{0}> set $maxwidth = 0 ddb{0}> show panic the kernel did not panic ddb{0}> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:399 witness_checkorder(ffff80000069e8d0,1,ffffffff81f33463,f5,0) at witness_checkorder+0xe19 witness_debugger sys/kern/subr_witness.c:2650 [inline] witness_checkorder(ffff80000069e8d0,1,ffffffff81f33463,f5,0) at witness_checkorder+0xe19 sys/kern/subr_witness.c:926 _rw_enter_read(ffff80000069e8c0,ffffffff81f33463,f5) at _rw_enter_read+0x80 sys/kern/kern_rwlock.c:102 wsmux_mux_open(ffff80000069e800,ffff800000026d50) at wsmux_mux_open+0x82 wsmux_do_open sys/dev/wscons/wsmux.c:246 [inline] wsmux_mux_open(ffff80000069e800,ffff800000026d50) at wsmux_mux_open+0x82 sys/dev/wscons/wsmux.c:228 wsmux_attach_sc(ffff800000026d00,ffff80000069e800) at wsmux_attach_sc+0x180 sys/dev/wscons/wsmux.c:670 VOP_IOCTL(fffffd8071d9ee48,80085761,ffff800020c14dc0,c7,fffffd807f7c7a20,ffff800020b42bd0) at VOP_IOCTL+0x9a sys/kern/vfs_vops.c:290 vn_ioctl(fffffd80671f30b8,80085761,ffff800020c14dc0,ffff800020b42bd0) at vn_ioctl+0xc9 sys/kern/vfs_vnops.c:512 sys_ioctl(ffff800020b42bd0,ffff800020c14f08,ffff800020c14ef0) at sys_ioctl+0x646 syscall(ffff800020c14fa0) at syscall+0x5ac mi_syscall sys/sys/syscall_mi.h:99 [inline] syscall(ffff800020c14fa0) at syscall+0x5ac sys/arch/amd64/amd64/trap.c:574 Xsyscall(6,0,ffffffffffffff86,0,3,d25e7902010) at Xsyscall+0x128 end of kernel end trace frame: 0xd28a60160d0, count: -10 ddb{0}> show registers rdi 0 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800020c149f0 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800001747000 rax 0xffff80000194fcc0 r8 0xffffffff818cb2f3 kprintf+0x183 r9 0x1 r10 0x25 r11 0xc5b23206bfed0cef 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 0xffff800020c149e0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.1) pid=147895 stat=onproc flags process=0 proc=4000000 pri=69, usrpri=69, nice=20 forw=0xffffffffffffffff, list=0xffff800020b43c38,0xffffffff8234a810 process=0xffff800020b44d30 user=0xffff800020c10000, vmspace=0xfffffd807effeb40 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 3969 146295 41052 0 2 0 syz-executor.1 * 3969 147895 41052 0 7 0x4000000 syz-executor.1 1448 291471 1 0 3 0x100083 ttyin getty 41052 382634 7490 0 3 0x82 nanosleep syz-executor.1 81321 420561 7490 0 3 0x82 nanosleep syz-executor.0 5356 340483 0 0 3 0x14200 bored sosplice 7490 183113 56467 0 3 0x82 thrsleep syz-fuzzer 7490 446100 56467 0 3 0x4000082 nanosleep syz-fuzzer 7490 465620 56467 0 3 0x4000082 thrsleep syz-fuzzer 7490 234492 56467 0 3 0x4000082 kqread syz-fuzzer 7490 156440 56467 0 3 0x4000082 thrsleep syz-fuzzer 7490 94678 56467 0 3 0x4000082 thrsleep syz-fuzzer 7490 109653 56467 0 3 0x4000082 thrsleep syz-fuzzer 7490 325145 56467 0 3 0x4000082 thrsleep syz-fuzzer 7490 3460 56467 0 3 0x4000082 nanosleep syz-fuzzer 7490 252007 56467 0 3 0x4000082 thrsleep syz-fuzzer 56467 166479 42477 0 3 0x10008a pause ksh 42477 489967 20311 0 3 0x92 select sshd 20311 55547 1 0 3 0x80 select sshd 526 378629 83809 73 7 0x100090 syslogd 83809 7352 1 0 3 0x100082 netio syslogd 97372 246334 1 77 3 0x100090 poll dhclient 37620 463071 1 0 3 0x80 poll dhclient 32127 57772 0 0 3 0x14200 pgzero zerothread 21927 241576 0 0 3 0x14200 aiodoned aiodoned 97271 36556 0 0 3 0x14200 syncer update 96453 13443 0 0 3 0x14200 cleaner cleaner 78515 100928 0 0 3 0x14200 reaper reaper 3054 374412 0 0 3 0x14200 pgdaemon pagedaemon 88797 108279 0 0 3 0x14200 bored crynlk 36639 466919 0 0 3 0x14200 bored crypto 79022 60304 0 0 3 0x40014200 acpi0 acpi0 54098 290794 0 0 3 0x40014200 idle1 64609 413191 0 0 3 0x14200 bored softnet 90250 173578 0 0 3 0x14200 bored systqmp 48588 343777 0 0 3 0x14200 bored systq 76673 493109 0 0 3 0x40014200 bored softclock 72773 245139 0 0 3 0x40014200 idle0 1 252860 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 3969 (syz-executor.1) thread 0xffff800020b42bd0 (147895) exclusive rwlock wsmuxlk r = 0 (0xffff800000026dd0) 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 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim Kern Lim devbuf 9512 6349K 6357K 78643K 10990 0 0 pcb 23 9K 10K 78643K 550 0 0 rtable 100 3K 4K 78643K 733 0 0 ifaddr 54 13K 14K 78643K 219 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 2K 78643K 40 0 0 iov 0 0K 32K 78643K 104 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1191 75K 75K 78643K 2043 0 0 UFS quota 1 32K 32K 78643K 1 0 0 UFS mount 5 36K 36K 78643K 5 0 0 shm 2 1K 9K 78643K 17 0 0 VM map 2 1K 1K 78643K 2 0 0 sem 12 0K 0K 78643K 107 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1792 194K 288K 78643K 12592 0 0 file desc 5 13K 21K 78643K 1127 0 0 sigio 0 0K 0K 78643K 12 0 0 proc 43 38K 66K 78643K 643 0 0 subproc 64 65538K 67586K 78643K 510 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 152 0 0 in_multi 33 2K 2K 78643K 211 0 0 ether_multi 1 0K 0K 78643K 5 0 0 mrt 0 0K 0K 78643K 2 0 0 ISOFS mount 1 32K 32K 78643K 1 0 0 MSDOSFS mount 1 16K 16K 78643K 1 0 0 ttys 90 397K 397K 78643K 90 0 0 exec 0 0K 1K 78643K 309 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 87 21K 21K 78643K 4472 0 0 UVM aobj 66 3K 3K 78643K 69 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 38 0 0 NDP 10 0K 0K 78643K 75 0 0 temp 155 2363K 2431K 78643K 6499 0 0 kqueue 0 0K 0K 78643K 13 0 0 SYN cache 2 16K 16K 78643K 2 0 0 ddb{0}> show all pools Name Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle arp 64 17 0 13 1 0 1 1 0 8 0 inpcbpl 280 550 0 543 1 0 1 1 0 8 0 plimitpl 152 56 0 49 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtentry 112 158 0 118 2 0 2 2 0 8 0 syncache 264 4 0 4 1 1 0 1 0 8 0 tcpcb 544 174 0 170 1 0 1 1 0 8 0 nd6 48 30 0 26 1 0 1 1 0 8 0 ppxss 1128 18 0 18 6 5 1 1 0 8 1 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 749 0 557 12 0 12 12 0 8 0 art_table 32 750 0 557 2 0 2 2 0 8 0 art_node 16 157 0 123 1 0 1 1 0 8 0 sysvmsgpl 40 7 0 3 1 0 1 1 0 8 0 semapl 112 105 0 95 1 0 1 1 0 8 0 shmpl 112 67 0 3 2 0 2 2 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 3436 0 2034 46 0 46 46 0 8 0 ffsino 272 3436 0 2034 95 0 95 95 0 8 0 nchpl 144 5179 0 3574 61 0 61 61 0 8 0 uvmvnodes 72 3782 0 0 69 0 69 69 0 8 0 vnodes 200 3782 0 0 200 0 200 200 0 8 0 namei 1024 15904 0 15904 1 0 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scsiplug 64 1 0 1 1 1 0 1 0 8 0 scxspl 192 13416 0 13416 12 11 1 7 0 8 1 sigapl 432 1258 0 1245 2 0 2 2 0 8 0 futexpl 56 11449 0 11449 1 0 1 1 0 8 1 knotepl 112 551 0 524 4 3 1 2 0 8 0 kqueuepl 104 370 0 368 1 0 1 1 0 8 0 pipepl 112 856 0 837 4 3 1 2 0 8 0 fdescpl 488 1259 0 1245 3 1 2 3 0 8 0 filepl 152 7980 0 7885 10 5 5 6 0 8 1 lockfpl 104 443 0 443 3 2 1 1 0 8 1 lockfspl 32 801 0 801 3 2 1 1 0 8 1 sessionpl 112 32 0 22 1 0 1 1 0 8 0 pgrppl 48 53 0 43 1 0 1 1 0 8 0 ucredpl 96 2159 0 2152 1 0 1 1 0 8 0 zombiepl 144 1245 0 1244 1 0 1 1 0 8 0 processpl 840 1274 0 1244 4 0 4 4 0 8 0 procpl 600 3624 0 3584 4 0 4 4 0 8 0 srpgc 64 78 0 78 3 3 0 1 0 8 0 sosppl 128 22 0 22 5 5 0 1 0 8 0 sockpl 384 1039 0 1022 4 1 3 3 0 8 1 mcl64k 65536 511 0 0 64 11 53 64 0 8 1 mcl16k 16384 2 0 0 1 0 1 1 0 8 0 mcl12k 12288 9 0 0 1 0 1 1 0 8 0 mcl9k 9216 8 0 0 1 0 1 1 0 8 0 mcl8k 8192 2 0 0 1 0 1 1 0 8 0 mcl4k 4096 16 0 0 2 0 2 2 0 8 0 mcl2k2 2112 1 0 0 1 0 1 1 0 8 0 mcl2k 2048 132 0 0 15 0 15 15 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 621 0 0 37 0 37 37 0 8 0 bufpl 256 7255 0 1020 390 0 390 390 0 8 0 anonpl 16 117036 0 108841 53 19 34 48 0 125 0 amapchunkpl 152 7420 0 7334 9 5 4 9 0 158 0 amappl16 192 5649 0 5217 39 16 23 32 0 8 1 amappl15 184 8 0 7 1 0 1 1 0 8 0 amappl14 176 453 0 448 2 1 1 1 0 8 0 amappl13 168 420 0 417 1 0 1 1 0 8 0 amappl12 160 15 0 13 2 1 1 1 0 8 0 amappl11 152 426 0 417 1 0 1 1 0 8 0 amappl10 144 71 0 66 1 0 1 1 0 8 0 amappl9 136 571 0 566 1 0 1 1 0 8 0 amappl8 128 226 0 202 1 0 1 1 0 8 0 amappl7 120 65 0 59 1 0 1 1 0 8 0 amappl6 112 511 0 496 1 0 1 1 0 8 0 amappl5 104 160 0 149 1 0 1 1 0 8 0 amappl4 96 666 0 643 2 1 1 2 0 8 0 amappl3 88 183 0 177 1 0 1 1 0 8 0 amappl2 80 10742 0 10689 2 0 2 2 0 8 0 amappl1 72 36335 0 35923 24 14 10 19 0 8 0 amappl 72 3926 0 3893 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 68 0 3 2 0 2 2 0 8 0 uaddrrnd 24 1259 0 1245 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 1259 0 1245 1 0 1 1 0 8 0 vmmpekpl 168 14090 0 14068 2 0 2 2 0 8 0 vmmpepl 168 141133 0 139757 102 36 66 73 0 357 1 vmsppl 360 1258 0 1245 2 0 2 2 0 8 0 pdppl 4096 2526 0 2490 6 1 5 6 0 8 0 pvpl 32 362450 0 351255 148 50 98 124 0 265 6 pmappl 224 1258 0 1245 1 0 1 1 0 8 0 extentpl 40 39 0 25 1 0 1 1 0 8 0 phpool 112 631 0 14 18 0 18 18 0 8 0