witness: lock order reversal: 1st 0xffff8000299dee30 &cq->cq_mtx (&cq->cq_mtx) 2nd 0xffffffff838cf288 &sched_lock (&sched_lock) lock order [1] &cq->cq_mtx (&cq->cq_mtx) -> [2] &sched_lock (&sched_lock) #0 mtx_enter+149 #1 sleep_setup+237 #2 msleep_nsec+267 #3 dt_ioctl_record_stop+188 #4 dtclose+265 #5 spec_close+1126 #6 VOP_CLOSE+306 #7 vn_closefile+299 #8 fdrop+289 #9 closef+402 #10 fdfree+278 #11 exit1+1398 #12 sys_exit+26 #13 syscall+2839 #14 Xsyscall+296 lock order [2] &sched_lock (&sched_lock) -> [1] &cq->cq_mtx (&cq->cq_mtx) #0 mtx_enter+149 #1 clockintr_cancel+47 #2 mi_switch+391 #3 sleep_finish+728 #4 sys_futex+2960 #5 syscall+3028 #6 Xsyscall+296 Stopped at db_enter+37: addq $8,%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+37 witness_checkorder(ffffffff838cf288,9,0) at witness_checkorder+4305 mtx_enter(ffffffff838cf278) at mtx_enter+149 sleep_setup(ffff8000299dee80,220,ffffffff83432e3f) at sleep_setup+237 msleep_nsec(ffff8000299dee80,ffff8000299dee20,220,ffffffff83432e3f,ffffffffffffffff) at msleep_nsec+267 dt_ioctl_record_stop(ffff800001593000) at dt_ioctl_record_stop+188 dtclose(11e5f,81,2000,ffff8000fffefca0) at dtclose+265 spec_close(ffff80002a2d85b0) at spec_close+1126 VOP_CLOSE(fffffd807b2ecd98,81,fffffd80097fd410,ffff8000fffefca0) at VOP_CLOSE+306 vn_closefile(fffffd80635be688,ffff8000fffefca0) at vn_closefile+299 fdrop(fffffd80635be688,ffff8000fffefca0) at fdrop+289 closef(fffffd80635be688,ffff8000fffefca0) at closef+402 fdfree(ffff8000fffefca0) at fdfree+278 exit1(ffff8000fffefca0,0,0,1) at exit1+1398 sys_exit(ffff8000fffefca0,ffff80002a2d8920,ffff80002a2d8870) at sys_exit+26 syscall(ffff80002a2d8920) at syscall+2839 Xsyscall() at Xsyscall+296 end of kernel end trace frame: 0x79d7240aed10, count: -17 ddb{0}> show registers rdi 0 rsi 0 rbp 18446603336928821888 rbx 0 rdx 0 rcx 18446603340516097184 rax 18446744071621210096 cpu_info_full_primary+8176 r8 18446603336928821600 r9 9259542123273814144 r10 10523014964827121071 r11 631404323605229518 r12 18446741324996849216 r13 18446741325004886832 r14 3 r15 18446744071616725744 substchar+51780 rip 18446744071589454453 db_enter+37 cs 8 rflags 582 rsp 18446603336928821872 ss 16 db_enter+37: addq $8,%rsp ddb{0}> show proc PROC (syz-executor) tid=301287 pid=24202 tcnt=0 stat=onproc flags process=1008 proc=2000 runpri=32, usrpri=50, slppri=32, nice=20 wchan=0x0, wmesg=, ps_single=0xffff8000fffefca0 scnt=-1 ecnt=1 forw=0xffffffffffffffff, list=0xffff80003a3d7a18,0xffff8000fffee2c0 process=0xffff80003a3d8020 user=0xffff80002a2d3000, vmspace=0xfffffd800b0633d0 estcpu=36, cpticks=0, pctcpu=0.0, user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 27714 516493 5626 0 2 0 syz-executor 27714 67737 5626 0 3 0x4000080 pipewr syz-executor 47145 327450 98256 60929 3 0x3010 suspend syz-executor 47145 119374 98256 60929 2 0x4081010 syz-executor 47145 478831 98256 60929 3 0x4081010 fltagain2 syz-executor 79707 172507 94980 0 2 0 syz-executor 79707 424445 94980 0 3 0x4000080 netacc syz-executor 79707 409234 94980 0 3 0x4000080 fsleep syz-executor 28915 513080 41752 0 3 0x3000 suspend syz-executor 28915 462107 41752 0 3 0x4081000 biowait syz-executor 28915 27808 41752 0 3 0x4081000 inode syz-executor 28915 518458 41752 0 3 0x4081000 inode syz-executor 98867 495041 21009 0 3 0x82 nanoslp syz-executor 90879 125184 0 0 3 0x14200 acct acct 42513 306415 21009 0 3 0x82 nanoslp syz-executor 94980 319080 21009 0 3 0x82 nanoslp syz-executor 5626 233456 21009 0 3 0x82 nanoslp syz-executor 28041 271319 1 0 3 0x100083 ttyopn getty 11904 447563 21009 0 3 0x82 wait syz-executor 41752 331024 21009 0 3 0x82 nanoslp syz-executor 8942 345561 21009 0 3 0x82 wait syz-executor 98256 93866 21009 0 3 0x82 nanoslp syz-executor 21009 313792 10469 0 2 0x2 syz-executor 10469 343380 88464 0 3 0x10008a sigsusp ksh 88464 433269 11966 0 3 0x98 kqread sshd-session 11966 68239 36376 0 3 0x92 kqread sshd-session 36376 54104 1 0 3 0x88 kqread sshd 95848 484785 39567 74 3 0x1100092 bpf pflogd 39567 166090 1 0 3 0x80 sbwait pflogd 38979 362079 68397 73 3 0x1100090 kqread syslogd 68397 343696 1 0 3 0x100082 sbwait syslogd 6149 393509 1 0 3 0x100080 kqread resolvd 68740 187507 72963 77 3 0x100092 kqread dhcpleased 60516 512329 72963 77 3 0x100092 kqread dhcpleased 72963 259343 1 0 3 0x80 kqread dhcpleased 43753 71378 0 0 3 0x14200 bored smr 26297 460332 0 0 2 0x14200 zerothread 18794 219568 0 0 3 0x14200 aiodoned aiodoned 2940 112878 0 0 3 0x14200 syncer update 49400 295081 0 0 3 0x14200 cleaner cleaner 62307 259943 0 0 3 0x14200 reaper reaper 89137 203102 0 0 3 0x14200 pgdaemon pagedaemon 61552 104740 0 0 3 0x14200 bored viomb 19771 395590 0 0 3 0x40014200 acpi0 acpi0 5455 109613 0 0 7 0x40014200 idle1 9311 255471 0 0 3 0x14200 bored softnet1 57670 490805 0 0 3 0x14200 bored softnet0 72244 89946 0 0 3 0x14200 bored systqmp 30914 157362 0 0 3 0x14200 bored systq 73804 93179 0 0 3 0x14200 tmoslp softclockmp 37650 161839 0 0 3 0x40014200 tmoslp softclock 43638 341969 0 0 3 0x40014200 idle0 1 168658 0 0 3 0x82 wait init 0 0 -1 0 3 0x10010200 scheduler swapper ddb{0}> show all locks CPU 0: exclusive mutex &cq->cq_mtx r = 0 (0xffff8000299dee30) #0 witness_lock+1521 #1 mtx_enter+1204 #2 clockintr_unbind+86 #3 dt_ioctl_record_stop+188 #4 dtclose+265 #5 spec_close+1126 #6 VOP_CLOSE+306 #7 vn_closefile+299 #8 fdrop+289 #9 closef+402 #10 fdfree+278 #11 exit1+1398 #12 sys_exit+26 #13 syscall+2839 #14 Xsyscall+296 Process 47145 (syz-executor) thread 0xffff80003b3fd248 (119374) exclusive rrwlock inode r = 0 (0xfffffd806e9dfb88) #0 witness_lock+1521 #1 rw_do_enter_write+1049 #2 rrw_enter+198 #3 VOP_LOCK+189 #4 vn_lock+164 #5 vn_write+399 #6 dofilewritev+578 #7 sys_write+162 #8 syscall+3028 #9 Xsyscall+296 Process 47145 (syz-executor) thread 0xffff80003b3fcfb0 (478831) exclusive rwlock sbufsnd r = 0 (0xffff8000015cd140) #0 witness_lock+1521 #1 rw_do_enter_write+1049 #2 sblock+182 #3 sosend+745 #4 dofilewritev+578 #5 sys_write+162 #6 syscall+3028 #7 Xsyscall+296 Process 28915 (syz-executor) thread 0xffff80003a3d7250 (462107) exclusive rrwlock inode r = 0 (0xfffffd8067c148f8) #0 witness_lock+1521 #1 rw_do_enter_write+1049 #2 rrw_enter+198 #3 VOP_LOCK+189 #4 vn_lock+164 #5 vn_write+399 #6 dofilewritev+578 #7 sys_write+162 #8 syscall+3028 #9 Xsyscall+296 Process 28915 (syz-executor) thread 0xffff80003a3d6d20 (27808) exclusive rrwlock inode r = 0 (0xfffffd806e8a3358) #0 witness_lock+1521 #1 rw_do_enter_write+1049 #2 rrw_enter+198 #3 VOP_LOCK+189 #4 vn_lock+164 #5 vfs_lookup+284 #6 namei+1994 #7 vn_open+497 #8 doopenat+859 #9 syscall+3028 #10 Xsyscall+296 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 11121 12149K 13469K 166960K 13917 0 pcb 18 16K 18K 166960K 895 0 rtable 225 15K 16K 166960K 902 0 pf 40 18K 20K 166960K 271 0 ifaddr 39 7K 8K 166960K 203 0 ifgroup 62 2K 3K 166960K 364 0 sysctl 4 1K 9K 166960K 29 0 counters 76 37K 38K 166960K 388 0 ioctlops 0 0K 4K 166960K 2085 0 iov 0 0K 16K 166960K 194 0 mount 1 1K 1K 166960K 1 0 log 0 0K 0K 166960K 4 0 vnodes 1384 87K 88K 166960K 3182 0 UFS quota 1 32K 32K 166960K 1 0 UFS mount 5 36K 36K 166960K 5 0 shm 2 1K 5K 166960K 40 0 VM map 2 1K 1K 166960K 2 0 sem 22 0K 1K 166960K 185 0 dirhash 12 2K 2K 166960K 78 0 ACPI 1692 195K 286K 166960K 12470 0 file desc 18 65K 240K 166960K 2392 0 sigio 0 0K 0K 166960K 39 0 proc 72 115K 147K 166960K 940 0 subproc 72 4K 4K 166960K 127 0 NFS srvsock 1 0K 0K 166960K 1 0 NFS daemon 1 16K 16K 166960K 1 0 ip_moptions 0 0K 0K 166960K 360 0 in_multi 70 5K 7K 166960K 300 0 ether_multi 1 0K 0K 166960K 40 0 mrt 1 0K 0K 166960K 18 0 ISOFS mount 1 32K 32K 166960K 1 0 MSDOSFS mount 1 16K 16K 166960K 1 0 ttys 265 1182K 1182K 166960K 265 0 exec 0 0K 1K 166960K 1044 0 fusefs mount 1 32K 32K 166960K 1 0 pfkey data 0 0K 0K 166960K 3 0 tdb 3 0K 0K 166960K 3 0 VM swap 8 62K 64K 166960K 10 0 UVM amap 263 168K 190K 166960K 22958 0 UVM aobj 134 14K 18K 166960K 171 0 pinsyscall 43 86K 104K 166960K 3665 0 memdesc 1 4K 4K 166960K 1 0 crypto data 1 1K 1K 166960K 1 0 ip6_options 0 0K 1K 166960K 206 0 NDP 16 0K 2K 166960K 140 0 temp 81 8680K 8794K 166960K 121968 0 kqueue 15 22K 33K 166960K 463 0 SYN cache 2 16K 16K 166960K 2 0 ddb{0}> show all pools Name Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle plcache 128 26 0 0 1 0 1 1 0 8 0 rtpcb 120 362 0 359 5 4 1 3 0 8 0 rtentry 176 264 0 186 6 0 6 6 0 8 0 unpcb 144 2102 0 2082 14 9 5 6 0 8 4 syncache 336 10 0 10 3 2 1 1 0 8 1 tcpqe 32 3 0 3 2 2 0 1 0 8 0 tcpcb 736 1003 0 997 15 12 3 7 0 8 2 arp 136 40 0 28 1 0 1 1 0 8 0 inpcb 328 3626 0 3615 32 25 7 13 0 8 5 nd6 152 51 0 31 2 0 2 2 0 8 0 pkpcb 40 23 0 23 4 3 1 1 0 8 1 kcovpl 48 14 0 6 1 0 1 1 0 8 0 mppekey 1024 3 0 3 3 2 1 1 0 8 1 ppxss 1192 116 0 114 1 0 1 1 0 8 0 pppxif 1504 19 0 19 3 2 1 1 0 8 1 pffrag 232 20 0 10 1 0 1 1 0 482 0 pffrnode 88 16 0 6 1 0 1 1 0 8 0 pffrent 40 31 0 21 1 0 1 1 0 8 0 pfosfp 40 1428 0 1005 5 0 5 5 0 8 0 pfosfpen 112 1428 0 714 21 0 21 21 0 8 0 pfrktable 1344 2 0 2 2 2 0 1 0 8 0 rttmr 136 3 0 3 3 2 1 1 0 8 1 art_heap8 4096 7 0 0 7 0 7 7 0 8 0 art_heap4 256 1197 0 829 35 9 26 30 0 8 2 art_table 40 1204 0 829 5 0 5 5 0 8 0 art_node 32 259 0 192 1 0 1 1 0 8 0 sysvmsgpl 40 20 0 11 1 0 1 1 0 8 0 semupl 112 3 0 3 2 1 1 1 0 8 1 semapl 112 179 0 159 1 0 1 1 0 8 0 shmpl 112 128 0 0 4 0 4 4 0 8 0 dirhash 1024 61 0 44 3 0 3 3 0 8 0 dino2pl 256 6337 0 4825 96 0 96 96 0 8 0 ffsino 296 6337 0 4825 117 0 117 117 0 8 0 nchpl 144 9678 0 9094 64 40 24 64 0 8 0 rtmask 32 27 0 26 4 3 1 1 0 8 0 vnodes 216 5926 0 0 330 0 330 330 0 8 0 namei 1024 35507 0 35505 3 2 1 2 0 8 0 percpumem 16 209 0 156 1 0 1 1 0 8 0 vcpupl 3968 4 0 1 1 0 1 1 0 8 0 vmpool 848 39 0 36 1 0 1 1 0 8 0 kstatmem 264 230 0 196 3 0 3 3 0 8 0 acpiwqpl 32 1 0 1 1 0 1 1 1 8 1 scsiplug 72 10 0 10 4 3 1 1 0 8 1 scxspl 216 76953 0 76952 13 12 1 8 1 8 0 plimitpl 152 870 0 851 1 0 1 1 0 8 0 sigapl 424 2674 0 2625 7 1 6 7 0 8 0 knotepl 120 577 0 0 17 0 17 17 0 8 0 kqueuepl 224 1040 0 1030 12 9 3 5 0 8 2 pipepl 344 463 0 435 15 11 4 9 0 8 1 fdescpl 528 2655 0 2623 3 0 3 3 0 8 0 filepl 160 20981 0 20747 33 16 17 23 0 8 6 lockfpl 104 1121 0 1115 4 3 1 4 0 8 0 lockfspl 48 331 0 325 1 0 1 1 0 8 0 sessionpl 144 31 0 22 1 0 1 1 0 8 0 pgrppl 48 82 0 65 1 0 1 1 0 8 0 ucredpl 104 4025 0 4010 1 0 1 1 0 8 0 zombiepl 144 2631 0 2625 1 0 1 1 0 8 0 processpl 1232 2674 0 2625 5 1 4 5 0 8 0 procpl 664 6223 0 6166 7 1 6 7 0 8 0 sosppl 176 19 0 19 4 3 1 1 0 8 1 sockpl 752 6249 0 6214 50 38 12 18 0 8 8 mcl64k 65536 16 0 0 2 0 2 2 0 8 0 mcl16k 16384 3 0 0 1 0 1 1 0 8 0 mcl12k 12288 1 0 0 1 0 1 1 0 8 0 mcl9k 9216 1 0 0 1 0 1 1 0 8 0 mcl8k 8192 2 0 0 1 0 1 1 0 8 0 mcl4k 4096 128 0 0 16 0 16 16 0 8 0 mcl2k2 2112 1 0 0 1 0 1 1 0 8 0 mcl2k 2048 53 0 0 6 1 5 5 0 8 0 mtagpl 96 6 0 0 1 0 1 1 0 8 0 mbufpl 256 1321 0 0 82 0 82 82 0 8 0 bufpl 280 34217 0 28081 439 0 439 439 0 8 0 anonpl 32 13133 0 0 106 0 106 106 0 246 0 amapchunkpl 152 82875 0 82329 53 19 34 37 0 158 10 amappl16 200 11454 0 11254 69 47 22 27 0 8 8 amappl15 192 6 0 6 1 1 0 1 0 8 0 amappl14 184 20 0 20 1 1 0 1 0 8 0 amappl13 176 492 0 491 1 0 1 1 0 8 0 amappl12 168 3057 0 3014 3 0 3 3 0 8 0 amappl11 160 7 0 7 2 2 0 1 0 8 0 amappl10 152 48 0 34 1 0 1 1 0 8 0 amappl9 144 257 0 257 1 1 0 1 0 8 0 amappl8 136 50 0 47 1 0 1 1 0 8 0 amappl7 128 101 0 100 1 0 1 1 0 8 0 amappl6 120 349 0 335 1 0 1 1 0 8 0 amappl5 112 75 0 63 1 0 1 1 0 8 0 amappl4 104 461 0 429 1 0 1 1 0 8 0 amappl3 96 14103 0 13999 4 1 3 3 0 8 0 amappl2 88 2761 0 2682 2 0 2 2 0 8 0 amappl1 80 19267 0 18664 15 2 13 14 0 8 0 amappl 88 21732 0 21548 5 0 5 5 0 92 0 uvmvnodes 80 211 0 0 5 0 5 5 0 8 0 dma65536 65536 4 0 4 2 1 1 1 0 8 1 dma4096 4096 2 0 2 2 1 1 1 0 8 1 dma1024 1024 3 0 2 1 0 1 1 0 8 0 dma512 512 1 0 1 1 1 0 1 0 8 0 dma256 256 10 0 10 5 5 0 1 0 8 0 dma128 128 255 0 255 3 2 1 1 0 8 1 dma64 64 8 0 8 2 2 0 1 0 8 0 dma32 32 7 0 7 1 1 0 1 0 8 0 dma16 16 18 0 17 1 0 1 1 0 8 0 aobjpl 72 170 0 37 3 0 3 3 0 8 0 uaddrrnd 24 2655 0 2623 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 2655 0 2623 1 0 1 1 0 8 0 vmmpekpl 168 20249 0 20206 3 0 3 3 0 8 0 vmmpepl 168 172695 0 170511 123 22 101 108 0 357 2 vmsppl 488 2654 0 2623 6 1 5 5 0 8 0 rwobjpl 80 47202 0 45728 38 4 34 36 0 8 0 pdppl 4096 5396 0 5321 120 43 77 86 0 8 2 pvpl 32 22210 0 0 180 1 179 179 0 265 0 pmappl 256 2693 0 2659 3 0 3 3 0 8 0 extentpl 40 45 0 27 1 0 1 1 0 8 0 phpool 112 407 0 79 10 0 10 10 0 8 0 ddb{0}> machine ddbcpu 0 Invalid cpu 0 ddb{0}> trace db_enter() at db_enter+37 witness_checkorder(ffffffff838cf288,9,0) at witness_checkorder+4305 mtx_enter(ffffffff838cf278) at mtx_enter+149 sleep_setup(ffff8000299dee80,220,ffffffff83432e3f) at sleep_setup+237 msleep_nsec(ffff8000299dee80,ffff8000299dee20,220,ffffffff83432e3f,ffffffffffffffff) at msleep_nsec+267 dt_ioctl_record_stop(ffff800001593000) at dt_ioctl_record_stop+188 dtclose(11e5f,81,2000,ffff8000fffefca0) at dtclose+265 spec_close(ffff80002a2d85b0) at spec_close+1126 VOP_CLOSE(fffffd807b2ecd98,81,fffffd80097fd410,ffff8000fffefca0) at VOP_CLOSE+306 vn_closefile(fffffd80635be688,ffff8000fffefca0) at vn_closefile+299 fdrop(fffffd80635be688,ffff8000fffefca0) at fdrop+289 closef(fffffd80635be688,ffff8000fffefca0) at closef+402 fdfree(ffff8000fffefca0) at fdfree+278 exit1(ffff8000fffefca0,0,0,1) at exit1+1398 sys_exit(ffff8000fffefca0,ffff80002a2d8920,ffff80002a2d8870) at sys_exit+26 syscall(ffff80002a2d8920) at syscall+2839 Xsyscall() at Xsyscall+296 end of kernel end trace frame: 0x79d7240aed10, count: -17 ddb{0}> machine ddbcpu 1 Stopped at x86_ipi_db+39: addq $8,%rsp ddb{1}> trace x86_ipi_db(ffff8000299ddff0) at x86_ipi_db+39 x86_ipi_handler() at x86_ipi_handler+217 Xresume_lapic_ipi() at Xresume_lapic_ipi+39 mtx_enter(ffff8000299dee20) at mtx_enter+887 clockintr_dispatch(ffff80002a21cd60) at clockintr_dispatch+1025 lapic_clockintr(0,0) at lapic_clockintr+81 Xresume_lapic_ltimer() at Xresume_lapic_ltimer+42 acpicpu_idle() at acpicpu_idle+1111 sched_idle(ffff8000299ddff0) at sched_idle+913 end trace frame: 0x0, count: -9