witness: lock order reversal: 1st 0xffff800020b3ab38 &pr->ps_mtx (&pr->ps_mtx) 2nd 0xffffffff8236e2f8 &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_pc+0x7 sys/dev/kcov.c:86 #7 exit1+0x6e5 sys/kern/kern_exit.c:292 #8 single_thread_check+0x144 sys/kern/kern_sig.c:1938 #9 userret+0x347 sys/kern/kern_sig.c:1907 #10 syscall+0x614 mi_syscall_return sys/sys/syscall_mi.h:122 [inline] #10 syscall+0x614 sys/arch/amd64/amd64/trap.c:596 #11 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(ffffffff8236e2f8,9,0) at witness_checkorder+0xffc witness_debugger sys/kern/subr_witness.c:2504 [inline] witness_checkorder(ffffffff8236e2f8,9,0) at witness_checkorder+0xffc sys/kern/subr_witness.c:1084 __mp_lock(ffffffff8236e0f0) at __mp_lock+0xa1 schedclock(ffff800020b399e0) at schedclock+0x99 sys/kern/sched_bsd.c:547 hardclock(ffff8000215f5780) 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,ffffffff81786b1b,ffff800020b3aa78,0,0,ffff800020b399e0) at Xresume_lapic_ltimer+0x26 __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x7 sys/dev/kcov.c:86 exit1(ffff800020b399e0,0,3) at exit1+0x6e5 sys/kern/kern_exit.c:292 single_thread_check(ffff800020b399e0,0) at single_thread_check+0x144 sys/kern/kern_sig.c:1938 userret(ffff800020b399e0) at userret+0x347 sys/kern/kern_sig.c:1907 syscall(ffff8000215f5ad0) at syscall+0x614 mi_syscall_return sys/sys/syscall_mi.h:122 [inline] syscall(ffff8000215f5ad0) at syscall+0x614 sys/arch/amd64/amd64/trap.c:596 Xsyscall(6,4,ffffffffffffffc1,0,3,bff18845010) at Xsyscall+0x128 end of kernel end trace frame: 0xc019e30e460, count: -13 ddb{0}> show registers rdi 0x3 rsi 0xffffffff82243e20 __sancov_gen_cov_switch_values.122 rbp 0xffff8000215f5580 rbx 0x3 rdx 0xffffffff821abff0 cpu_info_full_primary+0x1ff0 rcx 0x3 rax 0xffffffff821abff0 cpu_info_full_primary+0x1ff0 r8 0xffffffff81da2df5 witness_checkorder+0xfd5 r9 0x5 r10 0x3 r11 0x7ca9537f82b82fe7 r12 0xfffffd8002661340 r13 0xc r14 0xffffffff82337c00 w_lodata+0x48d50 r15 0xffffffff82345ee0 w_lodata+0x57030 rip 0xffffffff819ca3d8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff8000215f5570 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.0) pid=472445 stat=dead flags process=1010 proc=4082000 pri=24, usrpri=80, nice=20 forw=0xffffffffffffffff, list=0xffffffffffffffff,0xffffffffffffffff process=0xffff800020b3aa78 user=0xffff8000215f0000, vmspace=0xfffffd806e8e8008 estcpu=30, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 59949 84757 21828 32767 2 0x10 syz-executor.1 59949 247147 21828 32767 3 0x4000090 poll syz-executor.1 59949 178752 21828 32767 2 0x4000010 syz-executor.1 13054 122475 8649 32767 3 0x3010 suspend syz-executor.0 13054 468504 8649 32767 7 0x4081010 syz-executor.0 13054 263491 8649 32767 2 0x4081090 syz-executor.0 13054 282649 8649 32767 2 0x4081090 syz-executor.0 13054 378674 8649 32767 2 0x4081090 syz-executor.0 8649 387336 80030 32767 3 0x90 nanosleep syz-executor.0 80030 495993 8704 0 3 0x82 wait syz-executor.0 21828 271209 55846 32767 3 0x90 nanosleep syz-executor.1 55846 164198 8704 0 3 0x82 wait syz-executor.1 92143 237764 0 0 3 0x14200 bored sosplice 8704 503800 59902 0 3 0x82 thrsleep syz-fuzzer 8704 385375 59902 0 3 0x4000082 thrsleep syz-fuzzer 8704 304790 59902 0 3 0x4000082 kqread syz-fuzzer 8704 305680 59902 0 3 0x4000082 thrsleep syz-fuzzer 8704 165245 59902 0 3 0x4000082 thrsleep syz-fuzzer 8704 142445 59902 0 3 0x4000082 thrsleep syz-fuzzer 8704 302821 59902 0 3 0x4000082 thrsleep syz-fuzzer 8704 5473 59902 0 3 0x4000082 thrsleep syz-fuzzer 8704 163761 59902 0 3 0x4000082 thrsleep syz-fuzzer 8704 442747 59902 0 3 0x4000082 thrsleep syz-fuzzer 59902 209450 32176 0 3 0x10008a pause ksh 32176 405149 11313 0 3 0x92 select sshd 94596 168967 1 0 3 0x100083 ttyin getty 11313 207354 1 0 3 0x80 select sshd 88323 91225 33231 73 2 0x100090 syslogd 33231 461459 1 0 3 0x100082 netio syslogd 649 76557 1 77 3 0x100090 poll dhclient 76964 167646 1 0 3 0x80 poll dhclient 62088 420518 0 0 2 0x14200 zerothread 6462 40980 0 0 3 0x14200 aiodoned aiodoned 47655 266919 0 0 3 0x14200 syncer update 46334 511407 0 0 3 0x14200 cleaner cleaner 207 79938 0 0 3 0x14200 reaper reaper 53357 356043 0 0 3 0x14200 pgdaemon pagedaemon 46161 490905 0 0 3 0x14200 bored crynlk 63190 368710 0 0 3 0x14200 bored crypto 34757 83911 0 0 3 0x40014200 acpi0 acpi0 4284 101946 0 0 3 0x40014200 idle1 92065 2888 0 0 3 0x14200 bored softnet 60105 184503 0 0 3 0x14200 bored systqmp 68465 205970 0 0 3 0x14200 bored systq 40522 65720 0 0 3 0x40014200 bored softclock 15042 127519 0 0 3 0x40014200 idle0 55720 54550 0 0 3 0x14200 bored smr 1 282783 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 (0xffff800020b3ab38) #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 9462 6322K 6322K 78643K 10629 0 0 pcb 29 10K 11K 78643K 587 0 0 rtable 105 3K 3K 78643K 904 0 0 ifaddr 35 10K 10K 78643K 134 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 2K 78643K 51 0 0 iov 1 4K 16K 78643K 66 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1209 76K 76K 78643K 1717 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 20 0 0 VM map 2 1K 1K 78643K 2 0 0 sem 12 0K 1K 78643K 89 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1808 196K 290K 78643K 12628 0 0 file desc 8 25K 33K 78643K 1160 0 0 sigio 0 0K 0K 78643K 18 0 0 proc 41 38K 70K 78643K 1021 0 0 subproc 34 2K 2K 78643K 306 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 162 0 0 in_multi 33 2K 2K 78643K 240 0 0 ether_multi 1 0K 0K 78643K 9 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 439 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 98 21K 29K 78643K 4678 0 0 UVM aobj 40 2K 3K 78643K 46 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 60 0 0 NDP 5 0K 0K 78643K 57 0 0 temp 121 2734K 2800K 78643K 7279 0 0 kqueue 0 0K 0K 78643K 5 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 38 0 32 1 0 1 1 0 8 0 inpcbpl 280 598 0 591 1 0 1 1 0 8 0 plimitpl 152 102 0 93 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtentry 112 221 0 177 2 0 2 2 0 8 0 syncache 264 4 0 4 1 1 0 1 0 8 0 tcpcb 544 228 0 224 1 0 1 1 0 8 0 ipq 40 2 0 2 1 1 0 1 0 8 0 ipqe 40 4 0 4 1 1 0 1 0 8 0 nd6 48 54 0 48 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 902 0 711 12 0 12 12 0 8 0 art_table 32 903 0 711 2 0 2 2 0 8 0 art_node 16 220 0 180 1 0 1 1 0 8 0 sysvmsgpl 40 24 0 10 1 0 1 1 0 8 0 semupl 112 2 0 2 2 2 0 1 0 8 0 semapl 112 85 0 75 1 0 1 1 0 8 0 shmpl 112 44 0 6 2 0 2 2 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 2681 0 1251 47 0 47 47 0 8 0 ffsino 272 2681 0 1251 97 1 96 96 0 8 0 nchpl 144 4253 0 2633 61 0 61 61 0 8 0 uvmvnodes 72 2996 0 0 55 0 55 55 0 8 0 vnodes 200 2996 0 0 158 0 158 158 0 8 0 namei 1024 14461 0 14461 3 2 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 11175 0 11175 14 13 1 6 0 8 1 sigapl 432 1283 0 1267 3 1 2 3 0 8 0 futexpl 56 9985 0 9984 2 1 1 1 0 8 0 knotepl 112 557 0 538 1 0 1 1 0 8 0 kqueuepl 104 224 0 222 1 0 1 1 0 8 0 pipepl 112 826 0 803 4 3 1 2 0 8 0 fdescpl 488 1284 0 1267 3 0 3 3 0 8 0 filepl 152 7558 0 7452 9 4 5 7 0 8 0 lockfpl 104 240 0 240 4 3 1 1 0 8 1 lockfspl 48 78 0 78 4 3 1 1 0 8 1 sessionpl 112 33 0 23 1 0 1 1 0 8 0 pgrppl 48 47 0 37 1 0 1 1 0 8 0 ucredpl 96 2320 0 2311 1 0 1 1 0 8 0 zombiepl 144 1268 0 1267 3 2 1 1 0 8 0 processpl 888 1300 0 1267 4 0 4 4 0 8 0 procpl 600 3311 0 3262 4 0 4 4 0 8 0 srpgc 64 96 0 96 4 4 0 1 0 8 0 sosppl 128 10 0 10 4 4 0 1 0 8 0 sockpl 384 1209 0 1186 5 2 3 4 0 8 0 mcl64k 65536 4 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 2 0 0 1 0 1 1 0 8 0 mcl8k 8192 3 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 125 0 0 14 0 14 14 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 254 0 0 12 0 12 12 0 8 0 bufpl 256 6997 0 1159 365 0 365 365 0 8 0 anonpl 16 131197 0 125163 67 26 41 41 0 125 12 amapchunkpl 152 8959 0 8861 17 8 9 9 0 158 4 amappl16 192 4882 0 4581 48 24 24 28 0 8 8 amappl15 184 324 0 323 1 0 1 1 0 8 0 amappl14 176 532 0 526 2 1 1 1 0 8 0 amappl13 168 124 0 124 6 6 0 1 0 8 0 amappl12 160 34 0 31 1 0 1 1 0 8 0 amappl11 152 210 0 191 1 0 1 1 0 8 0 amappl10 144 117 0 114 2 1 1 1 0 8 0 amappl9 136 907 0 902 1 0 1 1 0 8 0 amappl8 128 456 0 434 1 0 1 1 0 8 0 amappl7 120 123 0 117 1 0 1 1 0 8 0 amappl6 112 158 0 150 1 0 1 1 0 8 0 amappl5 104 233 0 223 1 0 1 1 0 8 0 amappl4 96 1316 0 1291 1 0 1 1 0 8 0 amappl3 88 485 0 474 1 0 1 1 0 8 0 amappl2 80 8495 0 8419 4 2 2 3 0 8 0 amappl1 72 41506 0 41036 24 15 9 19 0 8 0 amappl 80 3793 0 3752 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 45 0 6 1 0 1 1 0 8 0 uaddrrnd 24 1284 0 1267 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 1284 0 1267 1 0 1 1 0 8 0 vmmpekpl 168 13749 0 13720 2 0 2 2 0 8 0 vmmpepl 168 148653 0 147147 116 40 76 76 0 357 10 vmsppl 360 1283 0 1267 2 0 2 2 0 8 0 pdppl 4096 2576 0 2534 6 0 6 6 0 8 0 pvpl 32 393714 0 384358 184 71 113 117 0 265 34 pmappl 232 1283 0 1267 4 3 1 2 0 8 0 extentpl 40 41 0 26 1 0 1 1 0 8 0 phpool 112 521 0 5 15 0 15 15 0 8 0