login: witness: lock order reversal: 1st 0xffff800020b8ceb8 &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+0x25 sys/dev/kcov.c:99 #7 witness_unlock+0x10c sys/kern/subr_witness.c:1272 #8 mtx_leave+0x97 sys/kern/kern_lock.c:360 #9 exit1+0x6e5 sys/kern/kern_exit.c:292 #10 single_thread_check+0x144 sys/kern/kern_sig.c:1938 #11 userret+0x347 sys/kern/kern_sig.c:1907 #12 syscall+0x614 mi_syscall_return sys/sys/syscall_mi.h:122 [inline] #12 syscall+0x614 sys/arch/amd64/amd64/trap.c:596 #13 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(ffff800020b392d8) at schedclock+0x99 sys/kern/sched_bsd.c:547 hardclock(ffff80002504b720) 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,ffff800020ab0ff0,0,0,ffffffff82243da0,d) at Xresume_lapic_ltimer+0x26 __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x25 sys/dev/kcov.c:99 witness_unlock(ffff800020b8ceb8,8) at witness_unlock+0x10c sys/kern/subr_witness.c:1272 mtx_leave(ffff800020b8cea8) at mtx_leave+0x97 sys/kern/kern_lock.c:360 exit1(ffff800020b392d8,0,3) at exit1+0x6e5 sys/kern/kern_exit.c:292 single_thread_check(ffff800020b392d8,0) at single_thread_check+0x144 sys/kern/kern_sig.c:1938 userret(ffff800020b392d8) at userret+0x347 sys/kern/kern_sig.c:1907 syscall(ffff80002504bb20) at syscall+0x614 mi_syscall_return sys/sys/syscall_mi.h:122 [inline] syscall(ffff80002504bb20) at syscall+0x614 sys/arch/amd64/amd64/trap.c:596 Xsyscall(6,4,4d92d7895a0,53,0,4d92d8da200) at Xsyscall+0x128 end of kernel end trace frame: 0x4d99b959ae0, count: -15 ddb{1}> show registers rdi 0x3 rsi 0xffffffff82243e20 __sancov_gen_cov_switch_values.122 rbp 0xffff80002504b520 rbx 0x3 rdx 0xffff800020ab0ff0 rcx 0x3 rax 0xffff800020ab0ff0 r8 0xffffffff81da2df5 witness_checkorder+0xfd5 r9 0x5 r10 0x3 r11 0x188d08949d21bdc4 r12 0xfffffd8002661340 r13 0xc r14 0xffffffff8233d1f0 w_lodata+0x4e340 r15 0xffffffff82346250 w_lodata+0x573a0 rip 0xffffffff819ca3d8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff80002504b510 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.1) pid=63790 stat=dead flags process=1010 proc=4082000 pri=50, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffffffffffffffff,0xffffffffffffffff process=0xffff800020b8cdf8 user=0xffff800025046000, vmspace=0xfffffd807effd000 estcpu=36, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 25411 352804 1772 32767 2 0x3010 syz-executor.1 5480 27708 15974 32767 2 0x10 syz-executor.0 5480 133845 15974 32767 3 0x4000090 ttyin syz-executor.0 5480 12247 15974 32767 7 0x4000010 syz-executor.0 1772 98880 60030 32767 3 0x90 nanosleep syz-executor.1 60030 438556 17822 0 3 0x82 wait syz-executor.1 15974 505661 74457 32767 3 0x90 nanosleep syz-executor.0 74457 103900 17822 0 3 0x82 wait syz-executor.0 17822 492745 8471 0 3 0x82 kqread syz-fuzzer 17822 322598 8471 0 3 0x4000082 thrsleep syz-fuzzer 17822 293587 8471 0 3 0x4000082 thrsleep syz-fuzzer 17822 357559 8471 0 3 0x4000082 thrsleep syz-fuzzer 17822 151805 8471 0 3 0x4000082 thrsleep syz-fuzzer 17822 219517 8471 0 3 0x4000082 thrsleep syz-fuzzer 17822 91425 8471 0 3 0x4000082 thrsleep syz-fuzzer 17822 298446 8471 0 3 0x4000082 thrsleep syz-fuzzer 17822 423247 8471 0 3 0x4000082 thrsleep syz-fuzzer 17822 350438 8471 0 3 0x4000082 thrsleep syz-fuzzer 8471 222315 19142 0 3 0x10008a pause ksh 19142 2300 99271 0 3 0x92 select sshd 95845 161205 1 0 3 0x100083 ttyin getty 99271 302916 1 0 3 0x80 select sshd 16152 200306 26179 73 2 0x100090 syslogd 26179 98401 1 0 3 0x100082 netio syslogd 22980 317194 1 77 3 0x100090 poll dhclient 72838 518657 1 0 3 0x80 poll dhclient 30516 154360 0 0 2 0x14200 zerothread 53278 110224 0 0 3 0x14200 aiodoned aiodoned 20606 315065 0 0 3 0x14200 syncer update 21240 88689 0 0 3 0x14200 cleaner cleaner 61838 459160 0 0 3 0x14200 reaper reaper 70631 178598 0 0 3 0x14200 pgdaemon pagedaemon 55244 130479 0 0 3 0x14200 bored crynlk 96896 463760 0 0 3 0x14200 bored crypto 50638 33522 0 0 3 0x40014200 acpi0 acpi0 77227 44224 0 0 3 0x40014200 idle1 98053 177041 0 0 3 0x14200 bored softnet 52033 282215 0 0 3 0x14200 bored systqmp 93482 106082 0 0 3 0x14200 bored systq 81374 374223 0 0 3 0x40014200 bored softclock 82331 328507 0 0 3 0x40014200 idle0 2960 127534 0 0 3 0x14200 bored smr 1 69910 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 (0xffff800020b8ceb8) #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{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim Kern Lim devbuf 9454 6321K 6321K 78643K 10541 0 0 pcb 23 9K 9K 78643K 67 0 0 rtable 105 3K 3K 78643K 191 0 0 ifaddr 34 9K 9K 78643K 34 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 2K 78643K 15 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1208 76K 76K 78643K 1214 0 0 UFS quota 1 32K 32K 78643K 1 0 0 UFS mount 5 36K 36K 78643K 5 0 0 shm 2 1K 1K 78643K 2 0 0 VM map 2 1K 1K 78643K 2 0 0 sem 5 0K 0K 78643K 6 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1808 196K 290K 78643K 12628 0 0 file desc 8 25K 33K 78643K 69 0 0 sigio 0 0K 0K 78643K 3 0 0 proc 41 38K 58K 78643K 288 0 0 subproc 34 2K 2K 78643K 34 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 4 0 0 in_multi 33 2K 2K 78643K 33 0 0 ether_multi 1 0K 0K 78643K 1 0 0 ISOFS mount 1 32K 32K 78643K 1 0 0 MSDOSFS mount 1 16K 16K 78643K 1 0 0 ttys 30 132K 132K 78643K 30 0 0 exec 0 0K 1K 78643K 182 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 83 20K 20K 78643K 1004 0 0 UVM aobj 6 2K 2K 78643K 6 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 12 0 0 NDP 5 0K 0K 78643K 9 0 0 temp 85 2721K 2785K 78643K 3102 0 0 kqueue 0 0K 0K 78643K 2 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 6 0 0 1 0 1 1 0 8 0 inpcbpl 280 66 0 57 1 0 1 1 0 8 0 plimitpl 152 18 0 8 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtentry 112 45 0 1 2 0 2 2 0 8 0 syncache 264 4 0 4 1 1 0 1 0 8 0 tcpcb 544 26 0 20 1 0 1 1 0 8 0 nd6 48 6 0 0 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 188 0 0 12 0 12 12 0 8 0 art_table 32 189 0 0 2 0 2 2 0 8 0 art_node 16 44 0 4 1 0 1 1 0 8 0 sysvmsgpl 40 2 0 2 1 0 1 1 0 8 1 semapl 112 4 0 1 1 0 1 1 0 8 0 shmpl 112 4 0 0 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 1469 0 53 46 0 46 46 0 8 0 ffsino 272 1469 0 53 95 0 95 95 0 8 0 nchpl 144 1737 0 105 61 0 61 61 0 8 0 uvmvnodes 72 1512 0 0 28 0 28 28 0 8 0 vnodes 200 1512 0 0 80 0 80 80 0 8 0 namei 1024 4217 0 4217 2 1 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 4285 0 4285 7 1 6 6 0 8 6 sigapl 432 240 0 224 3 0 3 3 0 8 1 futexpl 56 354 0 354 1 0 1 1 0 8 1 knotepl 112 57 0 38 1 0 1 1 0 8 0 kqueuepl 104 7 0 5 1 0 1 1 0 8 0 pipepl 112 162 0 143 2 1 1 1 0 8 0 fdescpl 488 241 0 224 3 0 3 3 0 8 0 filepl 152 1133 0 1032 6 1 5 5 0 8 1 lockfpl 104 22 0 22 2 1 1 1 0 8 1 lockfspl 48 6 0 6 2 1 1 1 0 8 1 sessionpl 112 17 0 7 1 0 1 1 0 8 0 pgrppl 48 17 0 7 1 0 1 1 0 8 0 ucredpl 96 85 0 76 1 0 1 1 0 8 0 zombiepl 144 225 0 224 2 1 1 1 0 8 0 processpl 888 256 0 224 4 0 4 4 0 8 0 procpl 600 337 0 293 4 0 4 4 0 8 0 sockpl 384 120 0 101 3 0 3 3 0 8 1 mcl12k 12288 1 0 0 1 0 1 1 0 8 0 mcl8k 8192 1 0 0 1 0 1 1 0 8 0 mcl4k 4096 2 0 0 1 0 1 1 0 8 0 mcl2k 2048 113 0 0 14 0 14 14 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 174 0 0 10 0 10 10 0 8 0 bufpl 256 5628 0 1159 280 0 280 280 0 8 0 anonpl 16 34043 0 27876 41 1 40 40 0 125 14 amapchunkpl 152 1169 0 1077 6 0 6 6 0 158 1 amappl16 192 782 0 476 27 0 27 27 0 8 11 amappl15 184 1 0 1 1 0 1 1 0 8 1 amappl14 176 37 0 33 2 1 1 1 0 8 0 amappl12 160 42 0 37 1 0 1 1 0 8 0 amappl11 152 50 0 36 1 0 1 1 0 8 0 amappl10 144 60 0 59 2 1 1 1 0 8 0 amappl9 136 557 0 554 1 0 1 1 0 8 0 amappl8 128 123 0 108 1 0 1 1 0 8 0 amappl7 120 30 0 26 1 0 1 1 0 8 0 amappl6 112 51 0 46 1 0 1 1 0 8 0 amappl5 104 148 0 133 1 0 1 1 0 8 0 amappl4 96 336 0 314 1 0 1 1 0 8 0 amappl3 88 212 0 196 1 0 1 1 0 8 0 amappl2 80 1113 0 1039 4 1 3 3 0 8 1 amappl1 72 13941 0 13464 23 6 17 19 0 8 7 amappl 80 562 0 523 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 5 0 0 1 0 1 1 0 8 0 uaddrrnd 24 241 0 224 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 241 0 224 1 0 1 1 0 8 0 vmmpekpl 168 5924 0 5899 2 0 2 2 0 8 0 vmmpepl 168 33836 0 32346 84 8 76 76 0 357 11 vmsppl 360 240 0 224 2 0 2 2 0 8 0 pdppl 4096 490 0 448 6 0 6 6 0 8 0 pvpl 32 121457 0 112100 114 1 113 113 0 265 37 pmappl 232 240 0 224 2 0 2 2 0 8 1 extentpl 40 41 0 26 1 0 1 1 0 8 0 phpool 112 428 0 3 13 0 13 13 0 8 0