witness: lock order reversal: 1st 0xffff800020b8c450 &pr->ps_mtx (&pr->ps_mtx) 2nd 0xffffffff82388e00 &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 exit1+0x732 sys/kern/kern_exit.c:300 #7 sys_exit+0x17 sys/kern/kern_exit.c:94 #8 syscall+0x552 mi_syscall sys/sys/syscall_mi.h:99 [inline] #8 syscall+0x552 sys/arch/amd64/amd64/trap.c:574 #9 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(ffffffff82388e00,9,0) at witness_checkorder+0xffc witness_debugger sys/kern/subr_witness.c:2504 [inline] witness_checkorder(ffffffff82388e00,9,0) at witness_checkorder+0xffc sys/kern/subr_witness.c:1084 __mp_lock(ffffffff82388bf8) at __mp_lock+0xa1 schedclock(ffff800020b38bd0) at schedclock+0x99 sys/kern/sched_bsd.c:547 hardclock(ffff800022e2b470) 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,0,ffff800020b8c440,0,ffff800020b8c390,2000) at Xresume_lapic_ltimer+0x26 exit1(ffff800020b38bd0,0,1) at exit1+0x732 sys/kern/kern_exit.c:300 sys_exit(ffff800020b38bd0,ffff800022e2b5e0,ffff800022e2b650) at sys_exit+0x17 sys/kern/kern_exit.c:94 syscall(ffff800022e2b6c0) at syscall+0x552 mi_syscall sys/sys/syscall_mi.h:99 [inline] syscall(ffff800022e2b6c0) at syscall+0x552 sys/arch/amd64/amd64/trap.c:574 Xsyscall(0,1,0,1,0,7f7ffffece14) at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffecde0, count: -11 ddb{1}> show registers rdi 0x3 rsi 0xffffffff821ba590 __sancov_gen_cov_switch_values.122 rbp 0xffff800022e2b270 rbx 0x3 rdx 0xffff800020aa8ff0 rcx 0x3 rax 0xffff800020aa8ff0 r8 0xffffffff812ec145 witness_checkorder+0xfd5 r9 0x5 r10 0x3 r11 0x22da8391706daa3 r12 0xfffffd8002661340 r13 0xc r14 0xffffffff822ea790 w_lodata+0x4b8a0 r15 0xffffffff822f5f20 w_lodata+0x57030 rip 0xffffffff81365a78 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800022e2b260 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.0) pid=297356 stat=dead flags process=1008 proc=2000 pri=32, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffffffffffffffff,0xffffffffffffffff process=0xffff800020b8c390 user=0xffff800022e26000, vmspace=0xfffffd807f00b000 estcpu=36, cpticks=5, pctcpu=0.0 user=0, sys=1, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 72813 522837 61309 0 2 0 syz-executor.1 72813 41388 61309 0 3 0x4000080 ttyin syz-executor.1 72813 132980 61309 0 3 0x4000080 fsleep syz-executor.1 23766 252028 1 0 3 0x100083 ttyin getty 90094 332553 0 0 3 0x14200 bored sosplice 94833 458696 73970 0 3 0x82 nanosleep syz-executor.0 61309 177014 73970 0 3 0x82 nanosleep syz-executor.1 73970 37892 50243 0 3 0x82 thrsleep syz-fuzzer 73970 422819 50243 0 3 0x4000082 thrsleep syz-fuzzer 73970 297606 50243 0 3 0x4000082 thrsleep syz-fuzzer 73970 470818 50243 0 3 0x4000082 thrsleep syz-fuzzer 73970 13315 50243 0 3 0x4000082 thrsleep syz-fuzzer 73970 182900 50243 0 3 0x4000082 thrsleep syz-fuzzer 73970 455810 50243 0 3 0x4000082 thrsleep syz-fuzzer 73970 407289 50243 0 3 0x4000082 thrsleep syz-fuzzer 73970 313829 50243 0 3 0x4000082 kqread syz-fuzzer 73970 121776 50243 0 3 0x4000082 thrsleep syz-fuzzer 50243 243797 8100 0 3 0x10008a pause ksh 8100 176845 90834 0 3 0x92 select sshd 90834 437969 1 0 3 0x80 select sshd 20731 277544 88820 74 3 0x100092 bpf pflogd 88820 332829 1 0 3 0x80 netio pflogd 6868 474217 2864 73 7 0x100090 syslogd 2864 261205 1 0 3 0x100082 netio syslogd 19686 154747 1 77 3 0x100090 poll dhclient 44639 95017 1 0 3 0x80 poll dhclient 67752 421024 0 0 2 0x14200 zerothread 81613 234256 0 0 3 0x14200 aiodoned aiodoned 84225 317789 0 0 3 0x14200 syncer update 14113 447148 0 0 3 0x14200 cleaner cleaner 28756 2948 0 0 3 0x14200 reaper reaper 43062 54556 0 0 3 0x14200 pgdaemon pagedaemon 25206 492771 0 0 3 0x14200 bored crynlk 38092 275103 0 0 3 0x14200 bored crypto 32205 512864 0 0 3 0x40014200 acpi0 acpi0 79742 388088 0 0 3 0x40014200 idle1 80842 323779 0 0 3 0x14200 bored softnet 75574 476978 0 0 3 0x14200 bored systqmp 39226 112437 0 0 3 0x14200 bored systq 40836 52424 0 0 3 0x40014200 bored softclock 92466 281830 0 0 3 0x40014200 idle0 94658 372138 0 0 3 0x14200 bored smr 1 283649 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 9529 6551K 6680K 78643K 11865 0 0 pcb 25 9K 11K 78643K 290 0 0 rtable 109 4K 4K 78643K 390 0 0 ifaddr 59 13K 13K 78643K 113 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 4K 78643K 1491 0 0 iov 0 0K 16K 78643K 77 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1210 76K 76K 78643K 1948 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 10 0 0 VM map 2 1K 1K 78643K 2 0 0 sem 12 0K 0K 78643K 428 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1808 196K 290K 78643K 12628 0 0 file desc 5 13K 25K 78643K 801 0 0 sigio 0 0K 0K 78643K 12 0 0 proc 54 51K 83K 78643K 527 0 0 subproc 32 2K 2K 78643K 68 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 41 0 0 in_multi 33 2K 2K 78643K 66 0 0 ether_multi 1 0K 0K 78643K 3 0 0 mrt 0 0K 0K 78643K 2 0 0 ISOFS mount 1 32K 32K 78643K 1 0 0 MSDOSFS mount 1 16K 16K 78643K 1 0 0 ttys 66 291K 291K 78643K 66 0 0 exec 0 0K 1K 78643K 260 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 95 21K 22K 78643K 3525 0 0 UVM aobj 25 2K 2K 78643K 27 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 27 0 0 NDP 12 0K 0K 78643K 32 0 0 temp 156 2727K 2793K 78643K 5663 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 10 0 4 1 0 1 1 0 8 0 inpcbpl 280 269 0 262 1 0 1 1 0 8 0 plimitpl 152 32 0 24 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtentry 112 71 0 27 2 0 2 2 0 8 0 syncache 264 4 0 4 1 1 0 1 0 8 0 tcpqe 32 7 0 7 1 1 0 1 0 8 0 tcpcb 544 103 0 99 1 0 1 1 0 8 0 nd6 48 12 0 6 1 0 1 1 0 8 0 ppxss 1128 9 0 9 6 6 0 1 0 8 0 pfosfp 40 846 0 423 5 0 5 5 0 8 0 pfosfpen 112 1428 0 714 21 0 21 21 0 8 0 pfstitem 24 16 0 14 1 0 1 1 0 8 0 pfstkey 112 16 0 14 1 0 1 1 0 8 0 pfstate 328 16 0 14 1 0 1 1 0 8 0 pfrule 1360 21 0 16 2 1 1 2 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 277 0 88 12 0 12 12 0 8 0 art_table 32 278 0 88 2 0 2 2 0 8 0 art_node 16 66 0 26 1 0 1 1 0 8 0 sysvmsgpl 40 6 0 2 1 0 1 1 0 8 0 semapl 112 426 0 416 1 0 1 1 0 8 0 shmpl 112 25 0 2 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 2768 0 1335 47 0 47 47 0 8 0 ffsino 272 2768 0 1335 96 0 96 96 0 8 0 nchpl 144 4005 0 2375 61 0 61 61 0 8 0 uvmvnodes 72 3144 0 0 58 0 58 58 0 8 0 vnodes 200 3144 0 0 166 0 166 166 0 8 0 namei 1024 12903 0 12903 2 1 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scsiplug 64 2 0 2 2 2 0 1 0 8 0 scxspl 192 10515 0 10514 15 14 1 6 0 8 0 sigapl 432 996 0 980 3 1 2 3 0 8 0 futexpl 56 9367 0 9366 1 0 1 1 0 8 0 knotepl 112 172 0 153 1 0 1 1 0 8 0 kqueuepl 104 101 0 99 1 0 1 1 0 8 0 pipepl 112 422 0 403 2 1 1 1 0 8 0 fdescpl 488 997 0 981 3 0 3 3 0 8 0 filepl 152 6260 0 6158 5 0 5 5 0 8 0 lockfpl 104 184 0 184 9 8 1 1 0 8 1 lockfspl 48 65 0 65 9 8 1 1 0 8 1 sessionpl 112 21 0 10 1 0 1 1 0 8 0 pgrppl 48 29 0 18 1 0 1 1 0 8 0 ucredpl 96 2539 0 2530 1 0 1 1 0 8 0 zombiepl 144 981 0 980 2 1 1 1 0 8 0 processpl 888 1013 0 980 4 0 4 4 0 8 0 procpl 600 2679 0 2635 5 1 4 5 0 8 0 srpgc 64 12 0 12 1 1 0 1 0 8 0 sosppl 128 5 0 5 2 2 0 1 0 8 0 sockpl 384 510 0 491 5 2 3 4 0 8 1 mcl64k 65536 8 0 0 1 0 1 1 0 8 0 mcl16k 16384 1 0 0 1 0 1 1 0 8 0 mcl12k 12288 7 0 0 1 0 1 1 0 8 0 mcl9k 9216 2 0 0 1 0 1 1 0 8 0 mcl8k 8192 2 0 0 1 0 1 1 0 8 0 mcl4k 4096 5 0 0 1 0 1 1 0 8 0 mcl2k 2048 119 0 0 14 0 14 14 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 184 0 0 10 0 10 10 0 8 0 bufpl 256 7153 0 1191 373 0 373 373 0 8 0 anonpl 16 89036 0 79012 67 26 41 57 0 125 0 amapchunkpl 152 5378 0 5277 7 2 5 6 0 158 0 amappl16 192 4211 0 3677 45 18 27 39 0 8 0 amappl15 184 262 0 261 1 0 1 1 0 8 0 amappl14 176 534 0 530 2 1 1 1 0 8 0 amappl13 168 2 0 2 1 1 0 1 0 8 0 amappl12 160 7 0 6 1 0 1 1 0 8 0 amappl11 152 66 0 48 1 0 1 1 0 8 0 amappl10 144 83 0 80 1 0 1 1 0 8 0 amappl9 136 621 0 618 1 0 1 1 0 8 0 amappl8 128 172 0 156 1 0 1 1 0 8 0 amappl7 120 46 0 41 1 0 1 1 0 8 0 amappl6 112 59 0 53 1 0 1 1 0 8 0 amappl5 104 137 0 122 1 0 1 1 0 8 0 amappl4 96 1153 0 1123 1 0 1 1 0 8 0 amappl3 88 691 0 679 1 0 1 1 0 8 0 amappl2 80 7174 0 7093 4 2 2 3 0 8 0 amappl1 72 31837 0 31379 25 15 10 20 0 8 0 amappl 80 2956 0 2916 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 26 0 2 1 0 1 1 0 8 0 uaddrrnd 24 997 0 980 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 997 0 980 1 0 1 1 0 8 0 vmmpekpl 168 10514 0 10478 2 0 2 2 0 8 0 vmmpepl 168 112873 0 111194 123 49 74 88 0 357 0 vmsppl 360 996 0 980 2 0 2 2 0 8 0 pdppl 4096 2001 0 1960 6 0 6 6 0 8 0 pvpl 32 293386 0 279548 172 59 113 144 0 265 1 pmappl 232 996 0 980 3 2 1 2 0 8 0 extentpl 40 41 0 26 1 0 1 1 0 8 0 phpool 112 526 0 4 15 0 15 15 0 8 0