login: witness: lock order reversal: 1st 0xffff800020b8d5a8 &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_cmp4+0x39 sys/dev/kcov.c:172 #7 splraise+0x3d sys/arch/amd64/amd64/intr.c:692 #8 witness_unlock+0x10c sys/kern/subr_witness.c:1272 #9 mtx_leave+0x97 sys/kern/kern_lock.c:360 #10 exit1+0x6e5 sys/kern/kern_exit.c:292 #11 sys_exit+0x17 sys/kern/kern_exit.c:94 #12 syscall+0x552 mi_syscall sys/sys/syscall_mi.h:99 [inline] #12 syscall+0x552 sys/arch/amd64/amd64/trap.c:574 #13 Xsyscall+0x128 Stopped at db_enter+0x18: addq $0x8,%rsp ddb{0}> ddb{0}> set $lines = 0 ddb{0}> set $maxwidth = 0 ddb{0}> show panic the kernel did not panic ddb{0}> 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(ffff800020b38bd0) at schedclock+0x99 sys/kern/sched_bsd.c:547 hardclock(ffff800022e191c0) 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,ffffffff819d995d,0,0,9,d) at Xresume_lapic_ltimer+0x26 __sanitizer_cov_trace_cmp4(9,d) at __sanitizer_cov_trace_cmp4+0x39 sys/dev/kcov.c:172 splraise(d) at splraise+0x3d sys/arch/amd64/amd64/intr.c:692 witness_unlock(ffff800020b8d5a8,8) at witness_unlock+0x10c sys/kern/subr_witness.c:1272 mtx_leave(ffff800020b8d598) at mtx_leave+0x97 sys/kern/kern_lock.c:360 exit1(ffff800020b38bd0,0,1) at exit1+0x6e5 sys/kern/kern_exit.c:292 sys_exit(ffff800020b38bd0,ffff800022e19470,ffff800022e194e0) at sys_exit+0x17 sys/kern/kern_exit.c:94 syscall(ffff800022e19550) at syscall+0x552 mi_syscall sys/sys/syscall_mi.h:99 [inline] syscall(ffff800022e19550) at syscall+0x552 sys/arch/amd64/amd64/trap.c:574 Xsyscall(6,1,0,1,0,7f7fffff59f4) at Xsyscall+0x128 end of kernel end trace frame: 0x7f7fffff59c0, count: -15 ddb{0}> show registers rdi 0x3 rsi 0xffffffff821c7a20 __sancov_gen_cov_switch_values.122 rbp 0xffff800022e18fc0 rbx 0x3 rdx 0xffffffff821cdff0 cpu_info_full_primary+0x1ff0 rcx 0x3 rax 0xffffffff821cdff0 cpu_info_full_primary+0x1ff0 r8 0xffffffff813b9985 witness_checkorder+0xfd5 r9 0x5 r10 0x3 r11 0x841b931b46b60c4e r12 0xfffffd8002662340 r13 0xc r14 0xffffffff8230fda0 w_lodata+0x4e760 r15 0xffffffff82318670 w_lodata+0x57030 rip 0xffffffff81e8beb8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800022e18fb0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.0) pid=104733 stat=dead flags process=1018 proc=2000 pri=50, usrpri=59, nice=20 forw=0xffffffffffffffff, list=0xffffffffffffffff,0xffffffffffffffff process=0xffff800020b8d4e8 user=0xffff800022e14000, vmspace=0xfffffd807effe438 estcpu=36, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 64732 266058 60329 32767 3 0x90 nanosleep syz-executor.1 60329 308737 57997 0 3 0x82 wait syz-executor.1 14328 521900 75904 32767 3 0x90 nanosleep syz-executor.0 75904 114814 57997 0 3 0x82 wait syz-executor.0 57997 253058 19395 0 3 0x82 thrsleep syz-fuzzer 57997 253365 19395 0 3 0x4000082 nanosleep syz-fuzzer 57997 406384 19395 0 3 0x4000082 thrsleep syz-fuzzer 57997 339183 19395 0 3 0x4000082 kqread syz-fuzzer 57997 339111 19395 0 3 0x4000082 nanosleep syz-fuzzer 57997 149557 19395 0 3 0x4000082 thrsleep syz-fuzzer 57997 471946 19395 0 3 0x4000082 thrsleep syz-fuzzer 57997 27001 19395 0 3 0x4000082 thrsleep syz-fuzzer 57997 441934 19395 0 3 0x4000082 thrsleep syz-fuzzer 57997 498191 19395 0 3 0x4000082 thrsleep syz-fuzzer 19395 421701 26663 0 3 0x10008a pause ksh 26663 467046 50411 0 3 0x92 select sshd 11766 110272 1 0 3 0x100083 ttyin getty 50411 216306 1 0 3 0x80 select sshd 94315 180289 49957 73 2 0x100090 syslogd 49957 7757 1 0 3 0x100082 netio syslogd 84392 523437 1 77 3 0x100090 poll dhclient 61343 201952 1 0 3 0x80 poll dhclient 51803 260618 0 0 3 0x14200 pgzero zerothread 34791 381425 0 0 3 0x14200 aiodoned aiodoned 97077 71111 0 0 3 0x14200 syncer update 47436 226555 0 0 3 0x14200 cleaner cleaner 82154 396031 0 0 7 0x14200 reaper 139 410061 0 0 3 0x14200 pgdaemon pagedaemon 88421 479860 0 0 3 0x14200 bored crynlk 56672 488203 0 0 3 0x14200 bored crypto 20499 414226 0 0 3 0x40014200 acpi0 acpi0 73 224495 0 0 3 0x40014200 idle1 77486 169458 0 0 3 0x14200 bored softnet 61409 39326 0 0 3 0x14200 bored systqmp 94114 313852 0 0 3 0x14200 bored systq 59505 327458 0 0 3 0x40014200 bored softclock 89484 466844 0 0 3 0x40014200 idle0 46186 267237 0 0 3 0x14200 bored smr 1 119117 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks CPU 0: exclusive mutex &pr->ps_mtx r = 0 (0xffff800020b8d5a8) #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{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim Kern Lim devbuf 9455 6321K 6321K 78643K 10542 0 0 pcb 23 9K 10K 78643K 91 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 19 0 0 iov 0 0K 1K 78643K 4 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1208 76K 76K 78643K 1229 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 4 0 0 VM map 2 1K 1K 78643K 2 0 0 sem 2 0K 0K 78643K 2 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1808 196K 290K 78643K 12628 0 0 file desc 6 17K 33K 78643K 61 0 0 proc 41 38K 70K 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 36 159K 159K 78643K 36 0 0 exec 0 0K 1K 78643K 184 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 85 20K 21K 78643K 985 0 0 UVM aobj 4 2K 2K 78643K 4 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 4 0 0 NDP 5 0K 0K 78643K 9 0 0 temp 80 2720K 2786K 78643K 3077 0 0 SYN cache 2 16K 16K 78643K 2 0 0 ddb{0}> 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 48 0 41 1 0 1 1 0 8 0 plimitpl 152 16 0 7 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 14 0 10 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 shmpl 112 2 0 0 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 1480 0 63 46 0 46 46 0 8 0 ffsino 272 1480 0 63 95 0 95 95 0 8 0 nchpl 144 1753 0 119 61 0 61 61 0 8 0 uvmvnodes 72 1523 0 0 28 0 28 28 0 8 0 vnodes 200 1523 0 0 81 0 81 81 0 8 0 namei 1024 4292 0 4292 2 1 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 4239 0 4239 8 7 1 6 0 8 1 sigapl 432 232 0 217 3 0 3 3 0 8 1 futexpl 56 325 0 325 1 0 1 1 0 8 1 knotepl 112 55 0 36 1 0 1 1 0 8 0 kqueuepl 104 13 0 11 1 0 1 1 0 8 0 pipepl 112 182 0 163 3 1 2 2 0 8 1 fdescpl 488 233 0 218 3 0 3 3 0 8 0 filepl 152 1229 0 1133 7 1 6 6 0 8 2 lockfpl 104 13 0 13 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 18 0 8 1 0 1 1 0 8 0 ucredpl 96 145 0 136 1 0 1 1 0 8 0 zombiepl 144 218 0 216 2 1 1 1 0 8 0 processpl 888 248 0 216 4 0 4 4 0 8 0 procpl 600 318 0 275 4 0 4 4 0 8 0 sockpl 384 126 0 109 3 0 3 3 0 8 1 mcl64k 65536 1 0 0 1 0 1 1 0 8 0 mcl9k 9216 1 0 0 1 0 1 1 0 8 0 mcl4k 4096 3 0 0 1 0 1 1 0 8 0 mcl2k 2048 115 0 0 14 0 14 14 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 162 0 0 10 0 10 10 0 8 0 bufpl 256 5620 0 1159 279 0 279 279 0 8 0 anonpl 16 27595 0 21858 25 1 24 24 0 125 0 amapchunkpl 152 1097 0 1007 6 0 6 6 0 158 2 amappl16 192 492 0 214 15 0 15 15 0 8 0 amappl15 184 23 0 22 1 0 1 1 0 8 0 amappl14 176 35 0 32 2 1 1 1 0 8 0 amappl13 168 10 0 8 2 1 1 1 0 8 0 amappl12 160 7 0 6 1 0 1 1 0 8 0 amappl11 152 56 0 41 1 0 1 1 0 8 0 amappl10 144 62 0 60 2 1 1 1 0 8 0 amappl9 136 569 0 563 1 0 1 1 0 8 0 amappl8 128 142 0 126 1 0 1 1 0 8 0 amappl7 120 33 0 27 1 0 1 1 0 8 0 amappl6 112 53 0 47 1 0 1 1 0 8 0 amappl5 104 112 0 102 1 0 1 1 0 8 0 amappl4 96 362 0 336 1 0 1 1 0 8 0 amappl3 88 174 0 163 1 0 1 1 0 8 0 amappl2 80 1074 0 1008 4 1 3 3 0 8 0 amappl1 72 13457 0 13018 24 7 17 19 0 8 8 amappl 80 541 0 504 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 3 0 0 1 0 1 1 0 8 0 uaddrrnd 24 233 0 217 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 233 0 217 1 0 1 1 0 8 0 vmmpekpl 168 5971 0 5944 2 0 2 2 0 8 0 vmmpepl 168 32622 0 31261 89 15 74 74 0 357 12 vmsppl 360 232 0 217 2 0 2 2 0 8 0 pdppl 4096 474 0 434 6 0 6 6 0 8 0 pvpl 32 112723 0 103850 104 2 102 102 0 265 30 pmappl 232 232 0 217 2 0 2 2 0 8 1 extentpl 40 41 0 26 1 0 1 1 0 8 0 phpool 112 427 0 3 13 0 13 13 0 8 0