witness: lock order reversal: 1st 0xffff800020b8c0d8 &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+0x50 sys/dev/kcov.c:102 #7 sched_exit+0x112 sys/kern/kern_sched.c:225 #8 exit1+0x8bf sys/kern/kern_exit.c:349 #9 single_thread_check+0x144 sys/kern/kern_sig.c:1938 #10 userret+0x347 sys/kern/kern_sig.c:1907 #11 syscall+0x614 mi_syscall_return sys/sys/syscall_mi.h:122 [inline] #11 syscall+0x614 sys/arch/amd64/amd64/trap.c:596 #12 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(ffff800020b39788) at schedclock+0x99 sys/kern/sched_bsd.c:547 hardclock(ffff800021626d90) 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,ffff800020b39788,0,0,ffff800020b8c0c8,ffff800020b8c0c8) at Xresume_lapic_ltimer+0x26 __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x50 sys/dev/kcov.c:102 sched_exit(ffff800020b39788) at sched_exit+0x112 sys/kern/kern_sched.c:225 exit1(ffff800020b39788,0,3) at exit1+0x8bf sys/kern/kern_exit.c:349 single_thread_check(ffff800020b39788,0) at single_thread_check+0x144 sys/kern/kern_sig.c:1938 userret(ffff800020b39788) at userret+0x347 sys/kern/kern_sig.c:1907 syscall(ffff800021627130) at syscall+0x614 mi_syscall_return sys/sys/syscall_mi.h:122 [inline] syscall(ffff800021627130) at syscall+0x614 sys/arch/amd64/amd64/trap.c:596 Xsyscall(6,4,9b358876480,53,0,9b35619b400) at Xsyscall+0x128 end of kernel end trace frame: 0x9b33c9892a0, count: -14 ddb{1}> show registers rdi 0x3 rsi 0xffffffff82243e20 __sancov_gen_cov_switch_values.122 rbp 0xffff800021626b90 rbx 0x3 rdx 0xffff800020ab0ff0 rcx 0x3 rax 0xffff800020ab0ff0 r8 0xffffffff81da2df5 witness_checkorder+0xfd5 r9 0x5 r10 0x3 r11 0x42d28d4d2a87ff74 r12 0xfffffd8002661340 r13 0xc r14 0xffffffff82334710 w_lodata+0x45860 r15 0xffffffff82345ee0 w_lodata+0x57030 rip 0xffffffff819ca3d8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800021626b80 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.0) pid=331360 stat=dead flags process=1010 proc=4082000 pri=50, usrpri=77, nice=20 forw=0xffffffffffffffff, list=0xffffffffffffffff,0xffffffffffffffff process=0xffff800020b8c018 user=0xffff800021622000, vmspace=0xfffffd807effd5a0 estcpu=36, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 24348 286681 62830 32767 2 0x3010 syz-executor.0 62830 501181 51568 32767 3 0x90 nanosleep syz-executor.0 51568 500727 67519 0 3 0x82 wait syz-executor.0 31930 290132 36709 32767 3 0x90 nanosleep syz-executor.1 36709 307205 67519 0 3 0x82 wait syz-executor.1 70593 479506 0 0 3 0x14200 bored sosplice 67519 116932 627 0 3 0x82 kqread syz-fuzzer 67519 70610 627 0 3 0x4000082 thrsleep syz-fuzzer 67519 104082 627 0 3 0x4000082 thrsleep syz-fuzzer 67519 418371 627 0 3 0x4000082 thrsleep syz-fuzzer 67519 177904 627 0 3 0x4000082 thrsleep syz-fuzzer 67519 476641 627 0 3 0x4000082 thrsleep syz-fuzzer 67519 294871 627 0 3 0x4000082 thrsleep syz-fuzzer 67519 285811 627 0 3 0x4000082 thrsleep syz-fuzzer 67519 72317 627 0 3 0x4000082 thrsleep syz-fuzzer 67519 93402 627 0 3 0x4000082 thrsleep syz-fuzzer 67519 133318 627 0 3 0x4000082 thrsleep syz-fuzzer 627 158126 6132 0 3 0x10008a pause ksh 6132 120521 11498 0 3 0x92 select sshd 5091 206696 1 0 3 0x100083 ttyin getty 11498 279405 1 0 3 0x80 select sshd 54052 86351 46658 73 7 0x100090 syslogd 46658 7694 1 0 3 0x100082 netio syslogd 26070 442202 1 77 3 0x100090 poll dhclient 8978 474603 1 0 3 0x80 poll dhclient 8957 502289 0 0 3 0x14200 pgzero zerothread 19923 247641 0 0 3 0x14200 aiodoned aiodoned 2381 389980 0 0 3 0x14200 syncer update 91823 44885 0 0 3 0x14200 cleaner cleaner 36502 26765 0 0 2 0x14200 reaper 29439 141426 0 0 3 0x14200 pgdaemon pagedaemon 63375 472574 0 0 3 0x14200 bored crynlk 3218 152293 0 0 3 0x14200 bored crypto 3950 207546 0 0 3 0x40014200 acpi0 acpi0 23750 423866 0 0 3 0x40014200 idle1 9067 276918 0 0 3 0x14200 bored softnet 12248 111873 0 0 3 0x14200 bored systqmp 93520 181239 0 0 3 0x14200 bored systq 39146 405712 0 0 3 0x40014200 bored softclock 45614 342296 0 0 3 0x40014200 idle0 90717 302971 0 0 3 0x14200 bored smr 1 496291 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 (0xffff800020b8c0d8) #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 sched_exit+0xa5 sys/kern/kern_sched.c:224 #4 exit1+0x8bf sys/kern/kern_exit.c:349 #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{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim Kern Lim devbuf 9460 6321K 6321K 78643K 10862 0 0 pcb 23 9K 11K 78643K 1615 0 0 rtable 105 3K 3K 78643K 2998 0 0 ifaddr 37 12K 12K 78643K 424 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 2K 78643K 140 0 0 iov 0 0K 24K 78643K 272 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1209 76K 76K 78643K 2926 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 35 0 0 VM map 2 1K 1K 78643K 2 0 0 sem 12 0K 0K 78643K 234 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1808 196K 290K 78643K 12628 0 0 file desc 7 21K 33K 78643K 3663 0 0 sigio 0 0K 0K 78643K 38 0 0 proc 41 38K 70K 78643K 3196 0 0 subproc 34 2K 2K 78643K 1105 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 440 0 0 in_multi 33 2K 2K 78643K 792 0 0 ether_multi 1 0K 0K 78643K 17 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 1137 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 31K 78643K 13056 0 0 UVM aobj 121 3K 3K 78643K 146 0 0 memdesc 1 4K 4K 78643K 1 0 0 crypto data 1 1K 1K 78643K 1 0 0 ip6_options 2 0K 0K 78643K 199 0 0 NDP 5 0K 0K 78643K 198 0 0 temp 121 2734K 2802K 78643K 17866 0 0 kqueue 0 0K 0K 78643K 47 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 132 0 126 1 0 1 1 0 8 0 inpcbpl 280 1736 0 1727 1 0 1 1 0 8 0 plimitpl 152 294 0 285 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtentry 112 738 0 694 2 0 2 2 0 8 0 syncache 264 4 0 4 1 1 0 1 0 8 0 tcpcb 544 653 0 647 1 0 1 1 0 8 0 ipq 40 1 0 1 1 1 0 1 0 8 0 ipqe 40 2 0 2 1 1 0 1 0 8 0 nd6 48 195 0 189 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 3020 0 2825 16 3 13 13 0 8 0 art_table 32 3021 0 2825 2 0 2 2 0 8 0 art_node 16 737 0 697 1 0 1 1 0 8 0 sysvmsgpl 40 30 0 18 1 0 1 1 0 8 0 semapl 112 232 0 222 1 0 1 1 0 8 0 shmpl 112 144 0 25 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 5269 0 3791 50 2 48 48 0 8 0 ffsino 272 5269 0 3791 99 0 99 99 0 8 0 nchpl 144 9663 0 8040 61 0 61 61 0 8 0 uvmvnodes 72 5926 0 0 108 0 108 108 0 8 0 vnodes 200 5926 0 0 312 0 312 312 0 8 0 namei 1024 36981 0 36981 3 2 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 26499 0 26499 30 29 1 6 0 8 1 sigapl 432 3645 0 3630 6 4 2 3 0 8 0 futexpl 56 28542 0 28542 1 0 1 1 0 8 1 knotepl 112 1973 0 1954 1 0 1 1 0 8 0 kqueuepl 104 716 0 714 1 0 1 1 0 8 0 pipepl 112 2322 0 2303 5 4 1 2 0 8 0 fdescpl 488 3646 0 3630 3 0 3 3 0 8 0 filepl 152 21034 0 20936 10 5 5 7 0 8 1 lockfpl 104 736 0 736 8 7 1 1 0 8 1 lockfspl 48 238 0 238 8 7 1 1 0 8 1 sessionpl 112 80 0 70 1 0 1 1 0 8 0 pgrppl 48 100 0 90 1 0 1 1 0 8 0 ucredpl 96 6238 0 6229 1 0 1 1 0 8 0 zombiepl 144 3631 0 3629 2 1 1 1 0 8 0 processpl 888 3662 0 3629 4 0 4 4 0 8 0 procpl 600 9632 0 9587 8 4 4 5 0 8 0 srpgc 64 378 0 378 12 12 0 1 0 8 0 sosppl 128 36 0 36 11 11 0 1 0 8 0 sockpl 384 3414 0 3395 7 4 3 4 0 8 1 mcl64k 65536 11 0 0 2 0 2 2 0 8 0 mcl16k 16384 5 0 0 1 0 1 1 0 8 0 mcl12k 12288 17 0 0 2 0 2 2 0 8 0 mcl9k 9216 17 0 0 2 0 2 2 0 8 0 mcl8k 8192 9 0 0 2 0 2 2 0 8 0 mcl4k 4096 17 0 0 3 0 3 3 0 8 0 mcl2k2 2112 11 0 0 1 0 1 1 0 8 0 mcl2k 2048 114 0 0 14 1 13 14 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 342 0 0 12 0 12 12 0 8 0 bufpl 256 10535 0 3530 438 0 438 438 0 8 0 anonpl 16 405023 0 398971 131 90 41 42 0 125 13 amapchunkpl 152 29761 0 29672 62 57 5 18 0 158 0 amappl16 192 16910 0 16606 151 123 28 29 0 8 11 amappl15 184 395 0 394 1 0 1 1 0 8 0 amappl14 176 884 0 880 2 1 1 1 0 8 0 amappl13 168 494 0 494 8 8 0 1 0 8 0 amappl12 160 779 0 773 1 0 1 1 0 8 0 amappl11 152 562 0 548 1 0 1 1 0 8 0 amappl10 144 404 0 401 2 1 1 1 0 8 0 amappl9 136 1847 0 1842 1 0 1 1 0 8 0 amappl8 128 1294 0 1262 2 0 2 2 0 8 0 amappl7 120 445 0 436 1 0 1 1 0 8 0 amappl6 112 494 0 485 1 0 1 1 0 8 0 amappl5 104 1256 0 1245 1 0 1 1 0 8 0 amappl4 96 3323 0 3301 1 0 1 1 0 8 0 amappl3 88 969 0 958 1 0 1 1 0 8 0 amappl2 80 23566 0 23497 4 2 2 3 0 8 0 amappl1 72 105378 0 104940 23 13 10 19 0 8 0 amappl 80 10928 0 10892 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 145 0 25 2 0 2 2 0 8 0 uaddrrnd 24 3646 0 3630 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 3646 0 3630 1 0 1 1 0 8 0 vmmpekpl 168 32887 0 32860 2 0 2 2 0 8 0 vmmpepl 168 412492 0 411091 172 95 77 77 0 357 11 vmsppl 360 3645 0 3630 2 0 2 2 0 8 0 pdppl 4096 7300 0 7260 6 0 6 6 0 8 0 pvpl 32 1088891 0 1079596 265 147 118 118 0 265 37 pmappl 232 3645 0 3630 8 7 1 2 0 8 0 extentpl 40 41 0 26 1 0 1 1 0 8 0 phpool 112 603 0 8 17 0 17 17 0 8 0