witness: lock order reversal: 1st 0xffff800020b8c450 &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 calcru+0x1e5 sys/kern/kern_resource.c:420 #7 exit1+0x737 sys/kern/kern_exit.c:301 #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(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(ffff800020b39c38) at schedclock+0x99 sys/kern/sched_bsd.c:547 hardclock(ffff800024e5adb0) 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,fffffd806dc87e28,0,0,0,0) at Xresume_lapic_ltimer+0x26 calcru(ffff800020b8c4b8,fffffd806dc87e18,fffffd806dc87e28,0) at calcru+0x1e5 sys/kern/kern_resource.c:420 exit1(ffff800020b39c38,100,1) at exit1+0x737 sys/kern/kern_exit.c:301 sys_exit(ffff800020b39c38,ffff800024e5afc0,ffff800024e5b030) at sys_exit+0x17 sys/kern/kern_exit.c:94 syscall(ffff800024e5b0a0) at syscall+0x552 mi_syscall sys/sys/syscall_mi.h:99 [inline] syscall(ffff800024e5b0a0) at syscall+0x552 sys/arch/amd64/amd64/trap.c:574 Xsyscall(6,1,16b9ccf40c10,1,7f7ffffe4660,1) at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffe44a0, count: -12 ddb{1}> show registers rdi 0x3 rsi 0xffffffff82243e20 __sancov_gen_cov_switch_values.122 rbp 0xffff800024e5abb0 rbx 0x3 rdx 0xffff800020ab0ff0 rcx 0x3 rax 0xffff800020ab0ff0 r8 0xffffffff81da2df5 witness_checkorder+0xfd5 r9 0x5 r10 0x3 r11 0xd536d19faaa433bf r12 0xfffffd8002661340 r13 0xc r14 0xffffffff82335dc0 w_lodata+0x46f10 r15 0xffffffff82346040 w_lodata+0x57190 rip 0xffffffff819ca3d8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800024e5aba0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (sh) pid=62662 stat=dead flags process=10000a proc=2000 pri=52, usrpri=52, nice=20 forw=0xffffffffffffffff, list=0xffffffffffffffff,0xffffffffffffffff process=0xffff800020b8c390 user=0xffff800024e56000, vmspace=0xfffffd807effd708 estcpu=4, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 21590 161741 52331 0 3 0x80 wait syz-executor.0 52331 175046 61895 0 3 0x82 wait syz-executor.0 92447 377476 15446 32767 3 0x90 piperd syz-executor.1 15446 364198 61895 0 3 0x82 wait syz-executor.1 21548 55614 0 0 3 0x14200 bored sosplice 61895 426600 50708 0 3 0x82 thrsleep syz-fuzzer 61895 425067 50708 0 3 0x4000082 nanosleep syz-fuzzer 61895 112124 50708 0 3 0x4000082 thrsleep syz-fuzzer 61895 58591 50708 0 3 0x4000082 thrsleep syz-fuzzer 61895 412966 50708 0 3 0x4000082 thrsleep syz-fuzzer 61895 333632 50708 0 3 0x4000082 thrsleep syz-fuzzer 61895 352074 50708 0 3 0x4000082 thrsleep syz-fuzzer 61895 431380 50708 0 3 0x4000082 thrsleep syz-fuzzer 61895 260415 50708 0 3 0x4000082 thrsleep syz-fuzzer 61895 154138 50708 0 3 0x4000082 kqread syz-fuzzer 50708 14289 18587 0 3 0x10008a pause ksh 18587 185407 65765 0 3 0x92 select sshd 52399 229063 1 0 3 0x100083 ttyin getty 65765 224707 1 0 3 0x80 select sshd 26914 128360 45894 73 7 0x100090 syslogd 45894 259136 1 0 3 0x100082 netio syslogd 5550 345882 1 77 3 0x100090 poll dhclient 19145 153443 1 0 3 0x80 poll dhclient 10705 99904 0 0 3 0x14200 pgzero zerothread 24207 8239 0 0 3 0x14200 aiodoned aiodoned 66808 69137 0 0 3 0x14200 syncer update 22312 94123 0 0 3 0x14200 cleaner cleaner 95680 61530 0 0 3 0x14200 reaper reaper 62464 61997 0 0 3 0x14200 pgdaemon pagedaemon 23226 360511 0 0 3 0x14200 bored crynlk 28567 71884 0 0 3 0x14200 bored crypto 37188 321294 0 0 3 0x40014200 acpi0 acpi0 74513 138713 0 0 3 0x40014200 idle1 14090 519414 0 0 3 0x14200 bored softnet 99130 170419 0 0 3 0x14200 bored systqmp 35273 511036 0 0 3 0x14200 bored systq 51308 3047 0 0 3 0x40014200 bored softclock 35610 38957 0 0 3 0x40014200 idle0 80487 417841 0 0 3 0x14200 bored smr 1 472702 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 (0xffff800020b8c450) #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 exit1+0x722 sys/kern/kern_exit.c:300 #4 sys_exit+0x17 sys/kern/kern_exit.c:94 #5 syscall+0x552 mi_syscall sys/sys/syscall_mi.h:99 [inline] #5 syscall+0x552 sys/arch/amd64/amd64/trap.c:574 #6 Xsyscall+0x128 ddb{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim Kern Lim devbuf 9454 6319K 6321K 78643K 10706 0 0 pcb 23 9K 11K 78643K 896 0 0 rtable 83 2K 3K 78643K 1618 0 0 ifaddr 30 10K 11K 78643K 234 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 2K 78643K 78 0 0 iov 0 0K 28K 78643K 110 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1209 76K 76K 78643K 2087 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 23 0 0 VM map 2 1K 1K 78643K 2 0 0 sem 12 0K 0K 78643K 99 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1808 196K 290K 78643K 12628 0 0 file desc 6 17K 33K 78643K 1863 0 0 sigio 0 0K 0K 78643K 29 0 0 proc 41 38K 58K 78643K 1726 0 0 subproc 34 2K 2K 78643K 595 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 228 0 0 in_multi 22 1K 2K 78643K 470 0 0 ether_multi 1 0K 0K 78643K 22 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 704 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 91 21K 30K 78643K 6958 0 0 UVM aobj 98 4K 4K 78643K 107 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 92 0 0 NDP 4 0K 0K 78643K 105 0 0 temp 114 2734K 2804K 78643K 10585 0 0 kqueue 0 0K 0K 78643K 16 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 70 0 66 1 0 1 1 0 8 0 inpcbpl 280 1025 0 1018 1 0 1 1 0 8 0 plimitpl 152 156 0 147 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtentry 112 397 0 364 2 0 2 2 0 8 0 syncache 264 4 0 4 1 1 0 1 0 8 0 tcpcb 544 395 0 391 1 0 1 1 0 8 0 nd6 48 102 0 99 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 1638 0 1491 13 0 13 13 0 8 2 art_table 32 1639 0 1491 2 0 2 2 0 8 0 art_node 16 396 0 366 1 0 1 1 0 8 0 sysvmsgpl 40 11 0 7 2 1 1 1 0 8 0 semapl 112 97 0 87 1 0 1 1 0 8 0 shmpl 112 105 0 9 3 0 3 3 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 3304 0 1866 47 0 47 47 0 8 0 ffsino 272 3304 0 1866 97 0 97 97 0 8 0 nchpl 144 5533 0 3913 61 0 61 61 0 8 0 uvmvnodes 72 3908 0 0 72 0 72 72 0 8 0 vnodes 200 3908 0 0 206 0 206 206 0 8 0 namei 1024 19878 0 19878 2 1 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 13937 0 13937 10 9 1 6 0 8 1 sigapl 432 1935 0 1920 4 2 2 3 0 8 0 futexpl 56 14683 0 14683 1 0 1 1 0 8 1 knotepl 112 1098 0 1077 1 0 1 1 0 8 0 kqueuepl 104 413 0 411 1 0 1 1 0 8 0 pipepl 112 1248 0 1229 5 4 1 2 0 8 0 fdescpl 488 1936 0 1921 3 0 3 3 0 8 0 filepl 152 11071 0 10976 8 4 4 6 0 8 0 lockfpl 104 209 0 209 7 7 0 1 0 8 0 lockfspl 48 71 0 71 7 7 0 1 0 8 0 sessionpl 112 50 0 40 1 0 1 1 0 8 0 pgrppl 48 64 0 54 1 0 1 1 0 8 0 ucredpl 96 3070 0 3062 1 0 1 1 0 8 0 zombiepl 144 1921 0 1920 2 1 1 1 0 8 0 processpl 888 1952 0 1920 4 0 4 4 0 8 0 procpl 600 4925 0 4884 4 0 4 4 0 8 0 srpgc 64 198 0 198 7 6 1 1 0 8 1 sosppl 128 50 0 50 7 7 0 1 0 8 0 sockpl 384 1940 0 1923 5 3 2 4 0 8 0 mcl64k 65536 4 0 0 1 0 1 1 0 8 0 mcl16k 16384 4 0 0 1 0 1 1 0 8 0 mcl12k 12288 9 0 0 1 0 1 1 0 8 0 mcl9k 9216 10 0 0 1 0 1 1 0 8 0 mcl8k 8192 5 0 0 1 0 1 1 0 8 0 mcl4k 4096 8 0 0 1 0 1 1 0 8 0 mcl2k2 2112 3 0 0 1 0 1 1 0 8 0 mcl2k 2048 123 0 0 15 0 15 15 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 238 0 0 12 0 12 12 0 8 0 bufpl 256 7368 0 1160 388 0 388 388 0 8 0 anonpl 16 194202 0 189166 72 45 27 41 0 125 0 amapchunkpl 152 14269 0 14167 22 17 5 9 0 158 0 amappl16 192 7796 0 7485 63 46 17 29 0 8 0 amappl15 184 408 0 407 4 3 1 1 0 8 0 amappl14 176 441 0 438 2 1 1 1 0 8 0 amappl13 168 312 0 312 3 2 1 1 0 8 1 amappl12 160 165 0 162 1 0 1 1 0 8 0 amappl11 152 221 0 207 1 0 1 1 0 8 0 amappl10 144 205 0 203 2 1 1 1 0 8 0 amappl9 136 1304 0 1300 1 0 1 1 0 8 0 amappl8 128 796 0 777 1 0 1 1 0 8 0 amappl7 120 205 0 193 1 0 1 1 0 8 0 amappl6 112 157 0 147 1 0 1 1 0 8 0 amappl5 104 477 0 463 1 0 1 1 0 8 0 amappl4 96 1979 0 1957 1 0 1 1 0 8 0 amappl3 88 491 0 481 1 0 1 1 0 8 0 amappl2 80 12444 0 12386 4 1 3 3 0 8 0 amappl1 72 59688 0 59255 23 13 10 19 0 8 0 amappl 80 5655 0 5618 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 106 0 9 2 0 2 2 0 8 0 uaddrrnd 24 1936 0 1920 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 1936 0 1920 1 0 1 1 0 8 0 vmmpekpl 168 19431 0 19403 2 0 2 2 0 8 0 vmmpepl 168 221618 0 220293 129 60 69 79 0 357 5 vmsppl 360 1935 0 1920 2 0 2 2 0 8 0 pdppl 4096 3880 0 3840 6 0 6 6 0 8 0 pvpl 32 569323 0 561080 166 81 85 111 0 265 5 pmappl 232 1935 0 1920 5 4 1 2 0 8 0 extentpl 40 41 0 26 1 0 1 1 0 8 0 phpool 112 544 0 3 16 0 16 16 0 8 0