witness: lock order reversal: 1st 0xffff800020b8d230 &pr->ps_mtx (&pr->ps_mtx) 2nd 0xffffffff82384c80 &sched_lock (&sched_lock) lock order "&sched_lock"(sched_lock) -> "&pr->ps_mtx"(mutex) first seen at: #0 witness_checkorder+0x6a7 sys/kern/subr_witness.c:877 #1 mtx_enter+0x3a sys/kern/kern_lock.c:265 #2 tuagg+0x32 sys/kern/kern_resource.c:360 #3 mi_switch+0x1c7 x86_atomic_clearbits_u32 sys/arch/amd64/compile/SYZKALLER/obj/machine/atomic.h:298 [inline] #3 mi_switch+0x1c7 sys/kern/sched_bsd.c:392 #4 sleep_finish+0x110 sys/kern/kern_synch.c:303 #5 msleep+0x1af sleep_finish_timeout sys/kern/kern_synch.c:327 [inline] #5 msleep+0x1af sleep_finish_all sys/kern/kern_synch.c:157 [inline] #5 msleep+0x1af sys/kern/kern_synch.c:220 #6 scsi_xs_sync+0x14f sys/scsi/scsi_base.c:1339 #7 scsi_start+0x86 sys/scsi/scsi_base.c:938 #8 sdopen+0x22b sys/scsi/sd.c:400 #9 spec_open+0x41c sys/kern/spec_vnops.c:158 #10 VOP_OPEN+0x6a sys/kern/vfs_vops.c:153 #11 sr_meta_native_bootprobe+0xd3 sys/dev/softraid.c:1038 #12 sr_boot_assembly+0x1aa sys/dev/softraid.c:1202 #13 sr_attach+0x183 sys/dev/softraid.c:1822 #14 config_attach+0x347 sys/kern/subr_autoconf.c:404 #15 main+0x6de sys/kern/init_main.c:483 #16 longmode_hi+0x95 lock order "&pr->ps_mtx"(mutex) -> "&sched_lock"(sched_lock) first seen at: #0 witness_checkorder+0x6a7 sys/kern/subr_witness.c:877 #1 __mp_lock+0xa1 #2 schedclock+0x99 sys/kern/sched_bsd.c:547 #3 hardclock+0x1d8 sys/kern/kern_clock.c:174 #4 lapic_clockintr+0x44 sys/arch/amd64/amd64/lapic.c:425 #5 Xresume_lapic_ltimer+0x26 #6 __sanitizer_cov_trace_cmp4+0x33 trace_cmp sys/dev/kcov.c:136 [inline] #6 __sanitizer_cov_trace_cmp4+0x33 sys/dev/kcov.c:170 #7 splraise+0x3d sys/arch/amd64/amd64/intr.c:692 #8 witness_unlock+0x10c sys/kern/subr_witness.c:1272 #9 mtx_leave+0x97 sys/kern/kern_lock.c:360 #10 exit1+0x6e5 sys/kern/kern_exit.c:292 #11 single_thread_check+0x144 sys/kern/kern_sig.c:1938 #12 userret+0x347 sys/kern/kern_sig.c:1907 #13 syscall+0x614 mi_syscall_return sys/sys/syscall_mi.h:122 [inline] #13 syscall+0x614 sys/arch/amd64/amd64/trap.c:596 #14 Xsyscall+0x128 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:398 witness_checkorder(ffffffff82384c80,9,0) at witness_checkorder+0xffc witness_debugger sys/kern/subr_witness.c:2504 [inline] witness_checkorder(ffffffff82384c80,9,0) at witness_checkorder+0xffc sys/kern/subr_witness.c:1084 __mp_lock(ffffffff82384a78) at __mp_lock+0xa1 schedclock(ffff800020b7c018) at schedclock+0x99 sys/kern/sched_bsd.c:547 hardclock(ffff800021c41b20) at hardclock+0x1d8 sys/kern/kern_clock.c:174 lapic_clockintr(0,0) at lapic_clockintr+0x44 sys/arch/amd64/amd64/lapic.c:425 Xresume_lapic_ltimer(9,ffffffff817951cd,0,0,9,d) at Xresume_lapic_ltimer+0x26 __sanitizer_cov_trace_cmp4(9,d) at __sanitizer_cov_trace_cmp4+0x33 trace_cmp sys/dev/kcov.c:136 [inline] __sanitizer_cov_trace_cmp4(9,d) at __sanitizer_cov_trace_cmp4+0x33 sys/dev/kcov.c:170 splraise(d) at splraise+0x3d sys/arch/amd64/amd64/intr.c:692 witness_unlock(ffff800020b8d230,8) at witness_unlock+0x10c sys/kern/subr_witness.c:1272 mtx_leave(ffff800020b8d220) at mtx_leave+0x97 sys/kern/kern_lock.c:360 exit1(ffff800020b7c018,0,3) at exit1+0x6e5 sys/kern/kern_exit.c:292 single_thread_check(ffff800020b7c018,0) at single_thread_check+0x144 sys/kern/kern_sig.c:1938 userret(ffff800020b7c018) at userret+0x347 sys/kern/kern_sig.c:1907 syscall(ffff800021c41f40) at syscall+0x614 mi_syscall_return sys/sys/syscall_mi.h:122 [inline] syscall(ffff800021c41f40) at syscall+0x614 sys/arch/amd64/amd64/trap.c:596 Xsyscall(6,0,ffffffffffffff54,0,3,ccba1de31a0) at Xsyscall+0x128 end of kernel end trace frame: 0xccdc1f04c30, count: -16 ddb{0}> show registers rdi 0x3 rsi 0xffffffff821fc9e0 __sancov_gen_cov_switch_values.122 rbp 0xffff800021c41920 rbx 0x3 rdx 0xffffffff821baff0 cpu_info_full_primary+0x1ff0 rcx 0x3 rax 0xffffffff821baff0 cpu_info_full_primary+0x1ff0 r8 0xffffffff818c8c95 witness_checkorder+0xfd5 r9 0x5 r10 0x3 r11 0x781afa6f3d5d9dff r12 0xfffffd8002661340 r13 0xc r14 0xffffffff82335700 w_lodata+0x4a4b0 r15 0xffffffff823423e0 w_lodata+0x57190 rip 0xffffffff81a42468 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800021c41910 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.0) pid=496030 stat=dead flags process=1000 proc=4082000 pri=26, usrpri=80, nice=20 forw=0xffffffffffffffff, list=0xffffffffffffffff,0xffffffffffffffff process=0xffff800020b8d170 user=0xffff800021c3c000, vmspace=0xfffffd807effd2d0 estcpu=30, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 85980 95984 90764 0 3 0x3000 suspend syz-executor.0 85980 191557 90764 0 2 0x4081080 syz-executor.0 85980 172274 90764 0 2 0x4081000 syz-executor.0 85980 172410 90764 0 2 0x4081080 syz-executor.0 44691 267001 0 0 3 0x14200 bored sosplice 25542 16710 13708 0 3 0x82 piperd syz-executor.1 90764 484266 13708 0 3 0x82 nanosleep syz-executor.0 13708 52936 61811 0 3 0x82 thrsleep syz-fuzzer 13708 283666 61811 0 3 0x4000082 thrsleep syz-fuzzer 13708 258315 61811 0 3 0x4000082 thrsleep syz-fuzzer 13708 307891 61811 0 3 0x4000082 thrsleep syz-fuzzer 13708 99413 61811 0 3 0x4000082 kqread syz-fuzzer 13708 166177 61811 0 3 0x4000082 thrsleep syz-fuzzer 13708 181706 61811 0 3 0x4000082 thrsleep syz-fuzzer 13708 77935 61811 0 3 0x4000082 thrsleep syz-fuzzer 13708 334186 61811 0 3 0x4000082 thrsleep syz-fuzzer 13708 56577 61811 0 3 0x4000082 thrsleep syz-fuzzer 61811 477238 96590 0 3 0x10008a pause ksh 96590 287324 10444 0 3 0x92 select sshd 4385 26651 1 0 3 0x100083 ttyopn getty 10444 132067 1 0 3 0x80 select sshd 90929 260294 62773 74 3 0x100092 bpf pflogd 62773 367731 1 0 3 0x80 netio pflogd 16157 480492 12488 73 2 0x100090 syslogd 12488 331030 1 0 3 0x100082 netio syslogd 43399 259842 1 77 3 0x100090 poll dhclient 16336 357717 1 0 3 0x80 poll dhclient 84125 8866 0 0 3 0x14200 pgzero zerothread 11114 208718 0 0 3 0x14200 aiodoned aiodoned 19201 54911 0 0 3 0x14200 syncer update 2571 83258 0 0 3 0x14200 cleaner cleaner 7218 190828 0 0 7 0x14200 reaper 51251 401002 0 0 3 0x14200 pgdaemon pagedaemon 82576 227491 0 0 3 0x14200 bored crynlk 76247 187674 0 0 3 0x14200 bored crypto 28171 239771 0 0 3 0x40014200 acpi0 acpi0 1934 359955 0 0 3 0x40014200 idle1 51145 107422 0 0 3 0x14200 bored softnet 90814 7825 0 0 3 0x14200 bored systqmp 86514 449909 0 0 3 0x14200 bored systq 78238 280451 0 0 3 0x40014200 bored softclock 97759 306829 0 0 3 0x40014200 idle0 47997 452400 0 0 3 0x14200 bored smr 1 311697 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks CPU 0: exclusive mutex &pr->ps_mtx r = 0 (0xffff800020b8d230) #0 witness_lock+0x52e sys/kern/subr_witness.c:1161 #1 mtx_enter_try+0x102 #2 mtx_enter+0x4b sys/kern/kern_lock.c:266 #3 tuagg+0x32 sys/kern/kern_resource.c:360 #4 exit1+0x6e5 sys/kern/kern_exit.c:292 #5 single_thread_check+0x144 sys/kern/kern_sig.c:1938 #6 userret+0x347 sys/kern/kern_sig.c:1907 #7 syscall+0x614 mi_syscall_return sys/sys/syscall_mi.h:122 [inline] #7 syscall+0x614 sys/arch/amd64/amd64/trap.c:596 #8 Xsyscall+0x128 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim Kern Lim devbuf 9520 6430K 7055K 78643K 12963 0 0 pcb 25 9K 10K 78643K 409 0 0 rtable 109 4K 4K 78643K 338 0 0 ifaddr 60 13K 14K 78643K 123 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 4K 78643K 1491 0 0 iov 0 0K 16K 78643K 103 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1204 76K 76K 78643K 2693 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 15 0 0 VM map 2 1K 1K 78643K 2 0 0 sem 12 0K 0K 78643K 73 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1808 196K 290K 78643K 12628 0 0 file desc 5 13K 25K 78643K 1258 0 0 sigio 0 0K 0K 78643K 15 0 0 proc 54 51K 71K 78643K 465 0 0 subproc 32 2K 2K 78643K 34 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 128 0 0 in_multi 33 2K 2K 78643K 83 0 0 ether_multi 1 0K 0K 78643K 3 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 66 291K 291K 78643K 66 0 0 exec 0 0K 1K 78643K 257 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 92 20K 30K 78643K 5295 0 0 UVM aobj 37 2K 3K 78643K 45 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 31 0 0 NDP 12 0K 0K 78643K 31 0 0 temp 175 2735K 2804K 78643K 6633 0 0 kqueue 0 0K 0K 78643K 7 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 6 0 0 1 0 1 1 0 8 0 inpcbpl 280 363 0 356 1 0 1 1 0 8 0 plimitpl 152 43 0 35 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtentry 112 49 0 5 2 0 2 2 0 8 0 syncache 264 4 0 4 1 1 0 1 0 8 0 tcpcb 544 148 0 144 1 0 1 1 0 8 0 nd6 48 6 0 0 1 0 1 1 0 8 0 ppxss 1128 14 0 14 4 3 1 1 0 8 1 pfosfp 40 846 0 423 5 0 5 5 0 8 0 pfosfpen 112 1428 0 714 21 0 21 21 0 8 0 pfstitem 24 16 0 11 1 0 1 1 0 8 0 pfstkey 112 16 0 11 1 0 1 1 0 8 0 pfstate 328 16 0 11 1 0 1 1 0 8 0 pfrule 1360 21 0 16 2 1 1 2 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 188 0 0 12 0 12 12 0 8 0 art_table 32 189 0 0 2 0 2 2 0 8 0 art_node 16 44 0 4 1 0 1 1 0 8 0 sysvmsgpl 40 18 0 4 1 0 1 1 0 8 0 semapl 112 71 0 61 1 0 1 1 0 8 0 shmpl 112 43 0 8 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 3941 0 2521 47 0 47 47 0 8 0 ffsino 272 3941 0 2521 96 0 96 96 0 8 0 nchpl 144 5723 0 4084 61 0 61 61 0 8 0 uvmvnodes 72 4436 0 0 81 0 81 81 0 8 0 vnodes 200 4436 0 0 234 0 234 234 0 8 0 namei 1024 21612 0 21612 1 0 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scsiplug 64 2 0 2 2 2 0 1 0 8 0 scxspl 192 13722 0 13722 9 8 1 6 0 8 1 sigapl 432 1458 0 1443 3 1 2 3 0 8 0 futexpl 56 15573 0 15572 1 0 1 1 0 8 0 knotepl 112 191 0 172 1 0 1 1 0 8 0 kqueuepl 104 173 0 171 1 0 1 1 0 8 0 pipepl 112 622 0 599 3 2 1 2 0 8 0 fdescpl 488 1459 0 1443 3 0 3 3 0 8 0 filepl 152 12384 0 12271 7 2 5 6 0 8 0 lockfpl 104 583 0 583 2 1 1 1 0 8 1 lockfspl 48 241 0 241 2 1 1 1 0 8 1 sessionpl 112 18 0 7 1 0 1 1 0 8 0 pgrppl 48 24 0 13 1 0 1 1 0 8 0 ucredpl 96 6633 0 6624 1 0 1 1 0 8 0 zombiepl 144 1444 0 1443 2 1 1 1 0 8 0 processpl 888 1475 0 1443 4 0 4 4 0 8 0 procpl 600 4525 0 4479 4 0 4 4 0 8 0 sosppl 128 8 0 8 3 2 1 1 0 8 1 sockpl 384 735 0 716 3 0 3 3 0 8 1 mcl64k 65536 6 0 0 1 0 1 1 0 8 0 mcl16k 16384 1 0 0 1 0 1 1 0 8 0 mcl12k 12288 10 0 0 1 0 1 1 0 8 0 mcl9k 9216 5 0 0 1 0 1 1 0 8 0 mcl8k 8192 6 0 0 1 0 1 1 0 8 0 mcl4k 4096 9 0 0 2 0 2 2 0 8 0 mcl2k2 2112 4 0 0 1 0 1 1 0 8 0 mcl2k 2048 127 0 0 15 0 15 15 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 172 0 0 10 0 10 10 0 8 0 bufpl 256 7795 0 1188 413 0 413 413 0 8 0 anonpl 16 133756 0 123621 64 23 41 57 0 125 0 amapchunkpl 152 8743 0 8644 18 13 5 11 0 158 0 amappl16 192 6927 0 6378 51 23 28 40 0 8 0 amappl14 176 36 0 34 2 1 1 1 0 8 0 amappl13 168 1228 0 1224 1 0 1 1 0 8 0 amappl12 160 8 0 7 1 0 1 1 0 8 0 amappl11 152 63 0 44 1 0 1 1 0 8 0 amappl10 144 75 0 72 1 0 1 1 0 8 0 amappl9 136 600 0 596 1 0 1 1 0 8 0 amappl8 128 142 0 127 1 0 1 1 0 8 0 amappl7 120 34 0 30 1 0 1 1 0 8 0 amappl6 112 59 0 52 1 0 1 1 0 8 0 amappl5 104 120 0 106 1 0 1 1 0 8 0 amappl4 96 2111 0 2082 1 0 1 1 0 8 0 amappl3 88 215 0 205 1 0 1 1 0 8 0 amappl2 80 11611 0 11538 3 1 2 3 0 8 0 amappl1 72 41421 0 40967 26 16 10 20 0 8 0 amappl 80 4770 0 4730 1 0 1 1 0 84 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 44 0 8 1 0 1 1 0 8 0 uaddrrnd 24 1459 0 1443 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 1459 0 1443 1 0 1 1 0 8 0 vmmpekpl 168 15827 0 15797 2 0 2 2 0 8 0 vmmpepl 168 163417 0 161791 105 29 76 85 0 357 1 vmsppl 360 1458 0 1443 2 0 2 2 0 8 0 pdppl 4096 2926 0 2886 6 0 6 6 0 8 0 pvpl 32 415138 0 401763 153 40 113 144 0 265 4 pmappl 232 1458 0 1443 2 1 1 2 0 8 0 extentpl 40 41 0 26 1 0 1 1 0 8 0 phpool 112 567 0 3 17 0 17 17 0 8 0