witness: lock order reversal: 1st 0xffff800020b3bc90 &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+0x221 sys/kern/kern_resource.c:423 #7 exit1+0x737 sys/kern/kern_exit.c:301 #8 postsig+0x4d7 sigexit sys/kern/kern_sig.c:1499 [inline] #8 postsig+0x4d7 sys/kern/kern_sig.c:1431 #9 userret+0x199 sys/kern/kern_sig.c:1883 #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{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(ffff800020b38bd0) at schedclock+0x99 sys/kern/sched_bsd.c:547 hardclock(ffff800022e0d4b0) 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,fffffd806dc13d98,0,0,0,0) at Xresume_lapic_ltimer+0x26 calcru(ffff800020b3bcf8,fffffd806dc13d88,fffffd806dc13d98,0) at calcru+0x221 sys/kern/kern_resource.c:423 exit1(ffff800020b38bd0,e,1) at exit1+0x737 sys/kern/kern_exit.c:301 postsig(ffff800020b38bd0,e) at postsig+0x4d7 sigexit sys/kern/kern_sig.c:1499 [inline] postsig(ffff800020b38bd0,e) at postsig+0x4d7 sys/kern/kern_sig.c:1431 userret(ffff800020b38bd0) at userret+0x199 sys/kern/kern_sig.c:1883 syscall(ffff800022e0d8c0) at syscall+0x614 mi_syscall_return sys/sys/syscall_mi.h:122 [inline] syscall(ffff800022e0d8c0) at syscall+0x614 sys/arch/amd64/amd64/trap.c:596 Xsyscall(0,0,16,57,0,2f772994000) at Xsyscall+0x128 end of kernel end trace frame: 0x7f7fffff9850, count: -13 ddb{1}> show registers rdi 0x3 rsi 0xffffffff82243e20 __sancov_gen_cov_switch_values.122 rbp 0xffff800022e0d2b0 rbx 0x3 rdx 0xffff800020ab0ff0 rcx 0x3 rax 0xffff800020ab0ff0 r8 0xffffffff81da2df5 witness_checkorder+0xfd5 r9 0x5 r10 0x3 r11 0xc3c366799e4ed5f7 r12 0xfffffd8002661340 r13 0xc r14 0xffffffff82337470 w_lodata+0x485c0 r15 0xffffffff82346040 w_lodata+0x57190 rip 0xffffffff819ca3d8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800022e0d2a0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.1) pid=421730 stat=dead flags process=1018 proc=2000 pri=50, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffffffffffffffff,0xffffffffffffffff process=0xffff800020b3bbd0 user=0xffff800022e08000, vmspace=0xfffffd806e8dcb48 estcpu=36, cpticks=4, pctcpu=0.0 user=0, sys=1, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 72407 430879 30789 32767 2 0x10 syz-executor.0 72407 247311 30789 32767 7 0x4000010 syz-executor.0 30789 48873 92989 32767 2 0x10 syz-executor.0 92989 412469 37103 0 3 0x82 wait syz-executor.0 723 348925 45538 32767 3 0x90 nanosleep syz-executor.1 45538 121114 37103 0 3 0x82 wait syz-executor.1 87054 427068 0 0 3 0x14200 bored sosplice 37103 356130 45142 0 3 0x82 thrsleep syz-fuzzer 37103 173741 45142 0 3 0x4000082 thrsleep syz-fuzzer 37103 363431 45142 0 3 0x4000082 thrsleep syz-fuzzer 37103 4026 45142 0 3 0x4000082 kqread syz-fuzzer 37103 131367 45142 0 3 0x4000082 thrsleep syz-fuzzer 37103 209387 45142 0 3 0x4000082 thrsleep syz-fuzzer 37103 274565 45142 0 3 0x4000082 thrsleep syz-fuzzer 37103 85915 45142 0 3 0x4000082 thrsleep syz-fuzzer 37103 193259 45142 0 3 0x4000082 thrsleep syz-fuzzer 37103 292065 45142 0 3 0x4000082 thrsleep syz-fuzzer 45142 409585 92637 0 3 0x10008a pause ksh 92637 147396 31394 0 3 0x92 select sshd 31420 106640 1 0 3 0x100083 ttyin getty 31394 293289 1 0 3 0x80 select sshd 27685 23473 50198 73 2 0x100090 syslogd 50198 155693 1 0 3 0x100082 netio syslogd 72206 3168 1 77 3 0x100090 poll dhclient 88376 457034 1 0 3 0x80 poll dhclient 28414 329736 0 0 2 0x14200 zerothread 53862 473550 0 0 3 0x14200 aiodoned aiodoned 50586 381705 0 0 3 0x14200 syncer update 44916 254013 0 0 3 0x14200 cleaner cleaner 46748 349120 0 0 3 0x14200 reaper reaper 29489 41131 0 0 3 0x14200 pgdaemon pagedaemon 61251 274127 0 0 3 0x14200 bored crynlk 8187 380108 0 0 3 0x14200 bored crypto 73941 265501 0 0 3 0x40014200 acpi0 acpi0 71932 110323 0 0 3 0x40014200 idle1 17889 172967 0 0 3 0x14200 bored softnet 58284 283306 0 0 3 0x14200 bored systqmp 2922 491517 0 0 3 0x14200 bored systq 31389 519720 0 0 3 0x40014200 bored softclock 10685 286270 0 0 3 0x40014200 idle0 58600 68566 0 0 3 0x14200 bored smr 1 88397 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 (0xffff800020b3bc90) #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 postsig+0x4d7 sigexit sys/kern/kern_sig.c:1499 [inline] #4 postsig+0x4d7 sys/kern/kern_sig.c:1431 #5 userret+0x199 sys/kern/kern_sig.c:1883 #6 syscall+0x614 mi_syscall_return sys/sys/syscall_mi.h:122 [inline] #6 syscall+0x614 sys/arch/amd64/amd64/trap.c:596 #7 Xsyscall+0x128 ddb{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim Kern Lim devbuf 9460 6321K 6321K 78643K 10792 0 0 pcb 23 9K 11K 78643K 1180 0 0 rtable 105 3K 3K 78643K 2380 0 0 ifaddr 36 11K 11K 78643K 339 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 2K 78643K 121 0 0 iov 0 0K 28K 78643K 186 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1209 76K 76K 78643K 2454 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 37 0 0 VM map 2 1K 1K 78643K 2 0 0 sem 12 0K 0K 78643K 135 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1808 196K 290K 78643K 12628 0 0 file desc 7 21K 33K 78643K 2468 0 0 sigio 0 0K 0K 78643K 34 0 0 proc 41 38K 70K 78643K 2482 0 0 subproc 34 2K 2K 78643K 867 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 211 0 0 in_multi 33 2K 2K 78643K 608 0 0 ether_multi 1 0K 0K 78643K 8 0 0 ISOFS mount 1 32K 32K 78643K 1 0 0 MSDOSFS mount 1 16K 16K 78643K 1 0 0 ttys 60 265K 265K 78643K 60 0 0 exec 0 0K 1K 78643K 928 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 82 20K 30K 78643K 8933 0 0 UVM aobj 88 3K 3K 78643K 108 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 82 0 0 NDP 5 0K 0K 78643K 156 0 0 temp 121 2734K 2802K 78643K 13800 0 0 kqueue 0 0K 0K 78643K 24 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 104 0 98 1 0 1 1 0 8 0 inpcbpl 280 1093 0 1086 1 0 1 1 0 8 0 plimitpl 152 215 0 206 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtentry 112 584 0 540 2 0 2 2 0 8 0 syncache 264 4 0 4 1 1 0 1 0 8 0 tcpcb 544 370 0 366 1 0 1 1 0 8 0 nd6 48 153 0 147 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 2398 0 2207 14 2 12 13 0 8 0 art_table 32 2399 0 2207 2 0 2 2 0 8 0 art_node 16 583 0 543 1 0 1 1 0 8 0 sysvmsgpl 40 21 0 8 2 1 1 1 0 8 0 semapl 112 133 0 123 1 0 1 1 0 8 0 shmpl 112 106 0 20 3 0 3 3 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 3841 0 2390 47 0 47 47 0 8 0 ffsino 272 3841 0 2390 97 0 97 97 0 8 0 nchpl 144 6696 0 5073 61 0 61 61 0 8 0 uvmvnodes 72 4717 0 0 86 0 86 86 0 8 0 vnodes 200 4717 0 0 249 0 249 249 0 8 0 namei 1024 25538 0 25538 2 1 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 17804 0 17804 9 8 1 6 0 8 1 sigapl 432 2492 0 2476 6 4 2 3 0 8 0 futexpl 56 18007 0 18007 1 0 1 1 0 8 1 knotepl 112 1505 0 1486 1 0 1 1 0 8 0 kqueuepl 104 494 0 492 1 0 1 1 0 8 0 pipepl 112 1688 0 1669 8 6 2 2 0 8 1 fdescpl 488 2493 0 2477 3 0 3 3 0 8 0 filepl 152 14135 0 14039 12 6 6 7 0 8 2 lockfpl 104 457 0 457 4 3 1 1 0 8 1 lockfspl 48 140 0 140 4 3 1 1 0 8 1 sessionpl 112 66 0 56 1 0 1 1 0 8 0 pgrppl 48 104 0 94 1 0 1 1 0 8 0 ucredpl 96 4015 0 4006 1 0 1 1 0 8 0 zombiepl 144 2477 0 2476 2 1 1 1 0 8 0 processpl 888 2509 0 2476 4 0 4 4 0 8 0 procpl 600 6204 0 6161 4 0 4 4 0 8 0 srpgc 64 294 0 294 6 6 0 1 0 8 0 sosppl 128 18 0 18 7 7 0 1 0 8 0 sockpl 384 2292 0 2275 6 3 3 4 0 8 1 mcl64k 65536 5 0 0 1 0 1 1 0 8 0 mcl16k 16384 1 0 0 1 0 1 1 0 8 0 mcl12k 12288 17 0 0 2 0 2 2 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 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 264 0 0 12 0 12 12 0 8 0 bufpl 256 9548 0 2543 438 0 438 438 0 8 0 anonpl 16 271136 0 264505 89 62 27 42 0 125 0 amapchunkpl 152 20332 0 20246 41 36 5 11 0 158 0 amappl16 192 10796 0 10463 97 80 17 28 0 8 0 amappl15 184 449 0 444 1 0 1 1 0 8 0 amappl14 176 859 0 854 2 1 1 1 0 8 0 amappl13 168 490 0 489 1 0 1 1 0 8 0 amappl12 160 230 0 228 1 0 1 1 0 8 0 amappl11 152 384 0 370 1 0 1 1 0 8 0 amappl10 144 293 0 289 2 1 1 1 0 8 0 amappl9 136 1396 0 1393 1 0 1 1 0 8 0 amappl8 128 880 0 860 1 0 1 1 0 8 0 amappl7 120 339 0 327 1 0 1 1 0 8 0 amappl6 112 251 0 241 1 0 1 1 0 8 0 amappl5 104 619 0 609 1 0 1 1 0 8 0 amappl4 96 2483 0 2452 2 1 1 2 0 8 0 amappl3 88 694 0 684 1 0 1 1 0 8 0 amappl2 80 15692 0 15615 4 2 2 3 0 8 0 amappl1 72 75348 0 74888 23 13 10 19 0 8 0 amappl 80 7197 0 7162 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 107 0 20 2 0 2 2 0 8 0 uaddrrnd 24 2493 0 2476 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 2493 0 2476 1 0 1 1 0 8 0 vmmpekpl 168 24721 0 24693 2 0 2 2 0 8 0 vmmpepl 168 283809 0 282287 139 69 70 83 0 357 3 vmsppl 360 2492 0 2476 2 0 2 2 0 8 0 pdppl 4096 4994 0 4952 6 0 6 6 0 8 0 pvpl 32 747825 0 737925 178 87 91 114 0 265 11 pmappl 232 2492 0 2476 8 6 2 2 0 8 1 extentpl 40 41 0 26 1 0 1 1 0 8 0 phpool 112 596 0 5 17 0 17 17 0 8 0