witness: lock order reversal: 1st 0xffff800020b3b918 &pr->ps_mtx (&pr->ps_mtx) 2nd 0xffffffff8236c9d8 &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_const_cmp4+0xb sys/dev/kcov.c:197 #7 exit1+0x6e5 sys/kern/kern_exit.c:292 #8 sys_exit+0x17 sys/kern/kern_exit.c:94 #9 syscall+0x552 mi_syscall sys/sys/syscall_mi.h:99 [inline] #9 syscall+0x552 sys/arch/amd64/amd64/trap.c:574 #10 Xsyscall+0x128 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:398 witness_checkorder(ffffffff8236c9d8,9,0) at witness_checkorder+0xffc witness_debugger sys/kern/subr_witness.c:2504 [inline] witness_checkorder(ffffffff8236c9d8,9,0) at witness_checkorder+0xffc sys/kern/subr_witness.c:1084 __mp_lock(ffffffff8236c7d0) at __mp_lock+0xa1 schedclock(ffff800020b392d8) at schedclock+0x99 sys/kern/sched_bsd.c:547 hardclock(ffff800024e53ac0) 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,0,0,0,0,ffff800020b3b908) at Xresume_lapic_ltimer+0x26 __sanitizer_cov_trace_const_cmp4(ffff800020b3b908,ffff800020b3b908) at __sanitizer_cov_trace_const_cmp4+0xb sys/dev/kcov.c:197 exit1(ffff800020b392d8,0,1) at exit1+0x6e5 sys/kern/kern_exit.c:292 sys_exit(ffff800020b392d8,ffff800024e53c90,ffff800024e53d00) at sys_exit+0x17 sys/kern/kern_exit.c:94 syscall(ffff800024e53d70) at syscall+0x552 mi_syscall sys/sys/syscall_mi.h:99 [inline] syscall(ffff800024e53d70) at syscall+0x552 sys/arch/amd64/amd64/trap.c:574 Xsyscall(6,1,0,1,0,7f7ffffd2d14) at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffd2ce0, count: -12 ddb{1}> show registers rdi 0x3 rsi 0xffffffff821c7a20 __sancov_gen_cov_switch_values.122 rbp 0xffff800024e538c0 rbx 0x3 rdx 0xffff800020ab0ff0 rcx 0x3 rax 0xffff800020ab0ff0 r8 0xffffffff813b9985 witness_checkorder+0xfd5 r9 0x5 r10 0x3 r11 0x5ef04724a84c4b54 r12 0xfffffd8002662340 r13 0xc r14 0xffffffff8230a440 w_lodata+0x48e00 r15 0xffffffff82318670 w_lodata+0x57030 rip 0xffffffff81e8beb8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800024e538b0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.1) pid=313689 stat=dead flags process=1018 proc=2000 pri=50, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffffffffffffffff,0xffffffffffffffff process=0xffff800020b3b858 user=0xffff800024e4e000, vmspace=0xfffffd807effeb40 estcpu=36, cpticks=2, pctcpu=0.0 user=0, sys=1, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 42235 487782 16684 32767 2 0x10 syz-executor.0 42235 415675 16684 32767 3 0x4000090 lockf syz-executor.0 42235 377305 16684 32767 3 0x4000090 lockf syz-executor.0 94367 428876 19875 32767 3 0x90 nanosleep syz-executor.1 19875 185020 40890 0 3 0x82 wait syz-executor.1 16684 352105 29854 32767 3 0x90 nanosleep syz-executor.0 29854 202198 40890 0 3 0x82 wait syz-executor.0 61837 104766 0 0 3 0x14200 bored sosplice 40890 32651 29697 0 3 0x82 thrsleep syz-fuzzer 40890 292602 29697 0 3 0x4000082 thrsleep syz-fuzzer 40890 60599 29697 0 3 0x4000082 thrsleep syz-fuzzer 40890 446065 29697 0 3 0x4000082 thrsleep syz-fuzzer 40890 102345 29697 0 3 0x4000082 thrsleep syz-fuzzer 40890 286676 29697 0 3 0x4000082 thrsleep syz-fuzzer 40890 187561 29697 0 3 0x4000082 kqread syz-fuzzer 40890 420422 29697 0 3 0x4000082 thrsleep syz-fuzzer 40890 312353 29697 0 3 0x4000082 thrsleep syz-fuzzer 40890 62247 29697 0 3 0x4000082 thrsleep syz-fuzzer 29697 105582 52648 0 3 0x10008a pause ksh 52648 448992 10567 0 3 0x92 select sshd 37806 390177 1 0 3 0x100083 ttyin getty 10567 83344 1 0 3 0x80 select sshd 70291 335378 69653 73 7 0x100090 syslogd 69653 289540 1 0 3 0x100082 netio syslogd 62598 458727 1 77 3 0x100090 poll dhclient 58686 200419 1 0 3 0x80 poll dhclient 53518 161616 0 0 2 0x14200 zerothread 58270 220452 0 0 3 0x14200 aiodoned aiodoned 58427 72122 0 0 3 0x14200 syncer update 98413 390038 0 0 3 0x14200 cleaner cleaner 98348 391772 0 0 3 0x14200 reaper reaper 79468 186111 0 0 3 0x14200 pgdaemon pagedaemon 72607 43677 0 0 3 0x14200 bored crynlk 21646 356049 0 0 3 0x14200 bored crypto 45846 241298 0 0 3 0x40014200 acpi0 acpi0 36855 405184 0 0 3 0x40014200 idle1 78161 452066 0 0 3 0x14200 bored softnet 89193 360081 0 0 3 0x14200 bored systqmp 31765 406796 0 0 3 0x14200 bored systq 83935 325138 0 0 3 0x40014200 bored softclock 70575 304411 0 0 3 0x40014200 idle0 45930 300683 0 0 3 0x14200 bored smr 1 106319 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks CPU 1: exclusive mutex &pr->ps_mtx r = 0 (0xffff800020b3b918) #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 sys_exit+0x17 sys/kern/kern_exit.c:94 #6 syscall+0x552 mi_syscall sys/sys/syscall_mi.h:99 [inline] #6 syscall+0x552 sys/arch/amd64/amd64/trap.c:574 #7 Xsyscall+0x128 ddb{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim Kern Lim devbuf 9459 6321K 6321K 78643K 10676 0 0 pcb 23 9K 10K 78643K 657 0 0 rtable 105 3K 3K 78643K 1348 0 0 ifaddr 36 10K 10K 78643K 197 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 2K 78643K 60 0 0 iov 0 0K 24K 78643K 68 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1208 76K 76K 78643K 1875 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 18 0 0 VM map 2 1K 1K 78643K 2 0 0 sem 12 0K 0K 78643K 77 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1808 196K 290K 78643K 12628 0 0 file desc 7 21K 33K 78643K 1364 0 0 sigio 0 0K 0K 78643K 22 0 0 proc 41 38K 70K 78643K 1469 0 0 subproc 34 2K 2K 78643K 476 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 156 0 0 in_multi 33 2K 2K 78643K 375 0 0 ether_multi 1 0K 0K 78643K 11 0 0 ISOFS mount 1 32K 32K 78643K 1 0 0 MSDOSFS mount 1 16K 16K 78643K 1 0 0 ttys 54 238K 238K 78643K 54 0 0 exec 0 0K 1K 78643K 569 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 94 21K 30K 78643K 5253 0 0 UVM aobj 62 4K 4K 78643K 65 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 74 0 0 NDP 5 0K 0K 78643K 87 0 0 temp 121 2734K 2802K 78643K 8806 0 0 kqueue 0 0K 0K 78643K 11 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 58 0 52 1 0 1 1 0 8 0 inpcbpl 280 696 0 689 1 0 1 1 0 8 0 plimitpl 152 109 0 100 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtentry 112 331 0 287 2 0 2 2 0 8 0 syncache 264 4 0 4 1 1 0 1 0 8 0 tcpcb 544 230 0 226 1 0 1 1 0 8 0 nd6 48 84 0 78 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 1353 0 1162 12 0 12 12 0 8 0 art_table 32 1354 0 1162 2 0 2 2 0 8 0 art_node 16 330 0 290 1 0 1 1 0 8 0 sysvmsgpl 40 30 0 19 1 0 1 1 0 8 0 semapl 112 75 0 65 1 0 1 1 0 8 0 shmpl 112 63 0 3 2 0 2 2 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 2787 0 1349 47 0 47 47 0 8 0 ffsino 272 2787 0 1349 97 1 96 97 0 8 0 nchpl 144 4509 0 2887 61 0 61 61 0 8 0 uvmvnodes 72 3272 0 0 60 0 60 60 0 8 0 vnodes 200 3272 0 0 173 0 173 173 0 8 0 namei 1024 15701 0 15701 3 2 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 12067 0 12067 17 13 4 6 0 8 4 sigapl 432 1457 0 1441 5 3 2 3 0 8 0 futexpl 56 10321 0 10321 2 1 1 1 0 8 1 knotepl 112 804 0 785 1 0 1 1 0 8 0 kqueuepl 104 243 0 241 1 0 1 1 0 8 0 pipepl 112 926 0 907 4 3 1 2 0 8 0 fdescpl 488 1458 0 1442 3 0 3 3 0 8 1 filepl 152 7944 0 7846 9 4 5 6 0 8 1 lockfpl 104 141 0 138 4 3 1 1 0 8 0 lockfspl 48 52 0 51 4 3 1 1 0 8 0 sessionpl 112 43 0 33 1 0 1 1 0 8 0 pgrppl 48 48 0 38 1 0 1 1 0 8 0 ucredpl 96 1978 0 1969 1 0 1 1 0 8 0 zombiepl 144 1442 0 1441 3 2 1 1 0 8 0 processpl 888 1474 0 1441 4 0 4 4 0 8 0 procpl 600 3495 0 3451 4 0 4 4 0 8 0 srpgc 64 156 0 156 5 4 1 1 0 8 1 sosppl 128 28 0 28 4 3 1 1 0 8 1 sockpl 384 1360 0 1343 4 1 3 3 0 8 1 mcl64k 65536 2 0 0 1 0 1 1 0 8 0 mcl16k 16384 2 0 0 1 0 1 1 0 8 0 mcl12k 12288 2 0 0 1 0 1 1 0 8 0 mcl9k 9216 5 0 0 1 0 1 1 0 8 0 mcl8k 8192 5 0 0 1 0 1 1 0 8 0 mcl4k 4096 6 0 0 1 0 1 1 0 8 0 mcl2k2 2112 3 0 0 1 0 1 1 0 8 0 mcl2k 2048 101 0 0 12 1 11 12 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 259 0 0 11 0 11 11 0 8 0 bufpl 256 7328 0 1159 386 0 386 386 0 8 0 anonpl 16 160954 0 155202 69 39 30 42 0 125 0 amapchunkpl 152 11647 0 11555 27 22 5 18 0 158 0 amappl16 192 6278 0 5953 72 54 18 28 0 8 1 amappl15 184 74 0 72 3 2 1 1 0 8 0 amappl14 176 401 0 396 2 1 1 1 0 8 0 amappl13 168 400 0 400 2 1 1 1 0 8 1 amappl12 160 78 0 77 1 0 1 1 0 8 0 amappl11 152 230 0 216 1 0 1 1 0 8 0 amappl10 144 317 0 313 2 1 1 1 0 8 0 amappl9 136 1015 0 1012 1 0 1 1 0 8 0 amappl8 128 510 0 487 1 0 1 1 0 8 0 amappl7 120 306 0 294 1 0 1 1 0 8 0 amappl6 112 183 0 175 1 0 1 1 0 8 0 amappl5 104 325 0 315 1 0 1 1 0 8 0 amappl4 96 1723 0 1702 1 0 1 1 0 8 0 amappl3 88 542 0 531 1 0 1 1 0 8 0 amappl2 80 8695 0 8619 4 2 2 3 0 8 0 amappl1 72 46531 0 46066 23 13 10 19 0 8 0 amappl 80 4123 0 4085 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 64 0 3 1 0 1 1 0 8 0 uaddrrnd 24 1458 0 1441 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 1458 0 1441 1 0 1 1 0 8 0 vmmpekpl 168 15823 0 15798 2 0 2 2 0 8 0 vmmpepl 168 168885 0 167376 115 46 69 76 0 357 3 vmsppl 360 1457 0 1441 2 0 2 2 0 8 0 pdppl 4096 2924 0 2882 6 0 6 6 0 8 0 pvpl 32 456470 0 447425 157 64 93 114 0 265 11 pmappl 232 1457 0 1441 5 4 1 2 0 8 0 extentpl 40 41 0 26 1 0 1 1 0 8 0 phpool 112 538 0 6 16 0 16 16 0 8 0