witness: lock order reversal: 1st 0xffff8000299bee30 &cq->cq_mtx (&cq->cq_mtx) 2nd 0xffffffff839a2bd8 &sched_lock (&sched_lock) lock order [1] &cq->cq_mtx (&cq->cq_mtx) -> [2] &sched_lock (&sched_lock) #0 mtx_enter+0x95 sys/kern/kern_lock.c:406 #1 sleep_setup+0xed sys/kern/kern_synch.c:304 #2 msleep_nsec+0x10b sys/kern/kern_synch.c:217 #3 dt_ioctl_record_stop+0xbc sys/dev/dt/dt_dev.c:589 #4 dtclose+0x109 dt_pcb_purge sys/dev/dt/dt_dev.c:-1 [inline] #4 dtclose+0x109 sys/dev/dt/dt_dev.c:239 #5 spec_close+0x466 sys/kern/spec_vnops.c:-1 #6 VOP_CLOSE+0x132 sys/kern/vfs_vops.c:156 #7 vn_closefile+0x12b vn_close sys/kern/vfs_vnops.c:292 [inline] #7 vn_closefile+0x12b sys/kern/vfs_vnops.c:615 #8 fdrop+0x121 sys/kern/kern_descrip.c:1281 #9 closef+0x192 sys/kern/kern_descrip.c:1265 #10 syscall+0xbd4 mi_syscall sys/sys/syscall_mi.h:176 [inline] #10 syscall+0xbd4 sys/arch/amd64/amd64/trap.c:783 #11 Xsyscall+0x128 lock order [2] &sched_lock (&sched_lock) -> [1] &cq->cq_mtx (&cq->cq_mtx) #0 mtx_enter+0x95 sys/kern/kern_lock.c:406 #1 clockintr_cancel+0x2f sys/kern/kern_clockintr.c:323 #2 mi_switch+0x187 sys/kern/sched_bsd.c:376 #3 ast+0x15c mi_ast sys/sys/syscall_mi.h:252 [inline] #3 ast+0x15c sys/arch/amd64/amd64/trap.c:747 #4 intr_user_exit+0x3c Stopped at db_enter+0x25: 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+0x25 sys/arch/amd64/amd64/db_interface.c:438 witness_checkorder(ffffffff839a2bd8,9,0) at witness_checkorder+0x10d1 sys/kern/subr_witness.c:-1 mtx_enter(ffffffff839a2bc8) at mtx_enter+0x95 sys/kern/kern_lock.c:406 sleep_setup(ffff8000299bee80,220,ffffffff834cabce) at sleep_setup+0xed sys/kern/kern_synch.c:304 msleep_nsec(ffff8000299bee80,ffff8000299bee20,220,ffffffff834cabce,ffffffffffffffff) at msleep_nsec+0x10b sys/kern/kern_synch.c:217 dt_ioctl_record_stop(ffff800001748000) at dt_ioctl_record_stop+0xbc sys/dev/dt/dt_dev.c:589 dtclose(21e5f,81,2000,ffff80003c497260) at dtclose+0x109 dt_pcb_purge sys/dev/dt/dt_dev.c:-1 [inline] dtclose(21e5f,81,2000,ffff80003c497260) at dtclose+0x109 sys/dev/dt/dt_dev.c:239 spec_close(ffff80002a2abfa0) at spec_close+0x466 sys/kern/spec_vnops.c:-1 VOP_CLOSE(fffffd800d46cbe0,81,fffffd80097fd2d8,ffff80003c497260) at VOP_CLOSE+0x132 sys/kern/vfs_vops.c:156 vn_closefile(fffffd805ea9dee0,ffff80003c497260) at vn_closefile+0x12b vn_close sys/kern/vfs_vnops.c:292 [inline] vn_closefile(fffffd805ea9dee0,ffff80003c497260) at vn_closefile+0x12b sys/kern/vfs_vnops.c:615 fdrop(fffffd805ea9dee0,ffff80003c497260) at fdrop+0x121 sys/kern/kern_descrip.c:1281 closef(fffffd805ea9dee0,ffff80003c497260) at closef+0x192 sys/kern/kern_descrip.c:1265 syscall(ffff80002a2ac200) at syscall+0xbd4 mi_syscall sys/sys/syscall_mi.h:176 [inline] syscall(ffff80002a2ac200) at syscall+0xbd4 sys/arch/amd64/amd64/trap.c:783 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x12ee73aa030, count: -14 ddb{0}> show registers rdi 0 rsi 0x80000 acpi_pdirpa+0x6be71 rbp 0xffff80002a2abc70 rbx 0 rdx 0xffff8000015beb80 rcx 0xffff80003c497260 rax 0x7ffff acpi_pdirpa+0x6be70 r8 0xffff80002a2abb50 r9 0x8080808080808080 r10 0x6f5dd865100c91f9 r11 0xdb123bc15e2e5a1e r12 0xfffffd800403ce40 r13 0xfffffd80047e7330 r14 0x3 r15 0xffffffff834b38d2 substchar+0x4e45 rip 0xffffffff82421825 db_enter+0x25 cs 0x8 rflags 0x246 rsp 0xffff80002a2abc60 ss 0x10 db_enter+0x25: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor) tid=410865 pid=30013 tcnt=2 stat=onproc flags process=0 proc=4000000 runpri=32, usrpri=50, slppri=32, nice=20 wchan=0x0, wmesg=, ps_single=0x0 scnt=0 ecnt=0 forw=0xffffffffffffffff, list=0xffff80003c496fc8,0xffffffff83977ec8 process=0xffff8000ffff3030 user=0xffff80002a2a7000, vmspace=0xfffffd806c47a208 estcpu=36, cpticks=0, pctcpu=0.0, user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 30013 509507 62650 0 3 0x80 fsleep syz-executor *30013 410865 62650 0 7 0x4000000 syz-executor 71519 281562 66366 60929 3 0x90 fsleep syz-executor 71519 340967 66366 60929 2 0x4000090 syz-executor 84080 391255 85775 0 3 0x80 fsleep syz-executor 84080 183220 85775 0 3 0x4000080 bell syz-executor 15025 119989 95944 0 2 0 syz-executor 15025 348348 95944 0 3 0x4000080 fsleep syz-executor 90629 471727 0 0 3 0x14200 acct acct 66252 142222 1 0 3 0x100083 ttyin getty 66366 480350 53498 0 3 0x82 nanoslp syz-executor 41268 301742 53498 0 2 0x2 syz-executor 39706 147640 0 0 3 0x14280 nfsidl nfsio 11519 33245 0 0 3 0x14280 nfsidl nfsio 94924 65056 0 0 3 0x14280 nfsidl nfsio 78926 461579 0 0 3 0x14280 nfsidl nfsio 46014 31863 0 0 3 0x14280 nfsidl nfsio 75710 65067 0 0 3 0x14280 nfsidl nfsio 35830 59501 0 0 3 0x14280 nfsidl nfsio 60394 359756 0 0 3 0x14280 nfsidl nfsio 43496 73606 0 0 3 0x14280 nfsidl nfsio 61769 241280 0 0 3 0x14280 nfsidl nfsio 91019 386276 0 0 3 0x14280 nfsidl nfsio 47375 516291 0 0 3 0x14280 nfsidl nfsio 34749 347297 0 0 3 0x14280 nfsidl nfsio 29793 309017 0 0 3 0x14280 nfsidl nfsio 47816 511710 0 0 3 0x14280 nfsidl nfsio 36501 453418 0 0 3 0x14280 nfsidl nfsio 70016 92154 0 0 3 0x14280 nfsidl nfsio 30328 433814 0 0 3 0x14280 nfsidl nfsio 46019 253297 0 0 3 0x14280 nfsidl nfsio 32814 338241 0 0 3 0x14280 nfsidl nfsio 30008 394773 53498 0 3 0x82 wait syz-executor 552 206196 53498 0 3 0x82 nanoslp syz-executor 69055 156172 53498 0 3 0x2 biowait syz-executor 95944 420463 53498 0 3 0x82 nanoslp syz-executor 85775 432525 53498 0 3 0x82 nanoslp syz-executor 62650 407091 53498 0 3 0x82 nanoslp syz-executor 53498 356433 1 0 3 0x82 kqread syz-executor 16217 31470 1 74 3 0x1100092 bpf pflogd 14849 27755 1 73 3 0x1100090 kqread syslogd 43669 165153 0 0 3 0x14200 bored smr 92232 445465 0 0 3 0x14200 pgzero zerothread 41123 418557 0 0 3 0x14200 aiodoned aiodoned 13568 471312 0 0 3 0x14200 syncer update 56260 426584 0 0 3 0x14200 cleaner cleaner 15311 40912 0 0 3 0x14200 reaper reaper 38300 297640 0 0 3 0x14200 pgdaemon pagedaemon 26850 221249 0 0 3 0x14200 bored viomb 74840 324313 0 0 3 0x40014200 acpi0 acpi0 19665 255657 0 0 3 0x40014200 idle1 61925 205432 0 0 3 0x14200 bored softnet1 97360 85142 0 0 3 0x14200 bored softnet0 73 517202 0 0 3 0x14200 bored systqmp 65704 414139 0 0 3 0x14200 bored systq 99570 484881 0 0 3 0x14200 tmoslp softclockmp 68342 491265 0 0 3 0x40014200 tmoslp softclock 81108 507229 0 0 3 0x40014200 idle0 1 284788 0 0 3 0x80082 wait init 0 0 -1 0 3 0x10010200 scheduler swapper ddb{0}> show all locks CPU 0: exclusive mutex &cq->cq_mtx r = 0 (0xffff8000299bee30) #0 witness_lock+0x5f1 stacktrace_save sys/sys/stacktrace.h:37 [inline] #0 witness_lock+0x5f1 sys/kern/subr_witness.c:1160 #1 mtx_enter+0x4b4 sys/kern/kern_lock.c:487 #2 clockintr_unbind+0x56 sys/kern/kern_clockintr.c:375 #3 dt_ioctl_record_stop+0xbc sys/dev/dt/dt_dev.c:589 #4 dtclose+0x109 dt_pcb_purge sys/dev/dt/dt_dev.c:-1 [inline] #4 dtclose+0x109 sys/dev/dt/dt_dev.c:239 #5 spec_close+0x466 sys/kern/spec_vnops.c:-1 #6 VOP_CLOSE+0x132 sys/kern/vfs_vops.c:156 #7 vn_closefile+0x12b vn_close sys/kern/vfs_vnops.c:292 [inline] #7 vn_closefile+0x12b sys/kern/vfs_vnops.c:615 #8 fdrop+0x121 sys/kern/kern_descrip.c:1281 #9 closef+0x192 sys/kern/kern_descrip.c:1265 #10 syscall+0xbd4 mi_syscall sys/sys/syscall_mi.h:176 [inline] #10 syscall+0xbd4 sys/arch/amd64/amd64/trap.c:783 #11 Xsyscall+0x128 CPU 1: exclusive mutex uaddr r = 0 (0xffffffff839a3000) #0 witness_lock+0x5f1 stacktrace_save sys/sys/stacktrace.h:37 [inline] #0 witness_lock+0x5f1 sys/kern/subr_witness.c:1160 #1 mtx_enter+0x4b4 sys/kern/kern_lock.c:487 #2 pool_put+0xa6 sys/kern/subr_pool.c:803 #3 uvm_map_teardown+0x341 sys/uvm/uvm_map.c:2533 #4 exit1+0x6fc sys/kern/kern_exit.c:260 #5 sys_exit+0x1a sys/kern/kern_exit.c:-1 #6 syscall+0xb17 mi_syscall sys/sys/syscall_mi.h:176 [inline] #6 syscall+0xb17 sys/arch/amd64/amd64/trap.c:783 #7 Xsyscall+0x128 Process 30013 (syz-executor) thread 0xffff80003c497260 (410865) exclusive rwlock dtlk r = 0 (0xffffffff839111f8) #0 witness_lock+0x5f1 stacktrace_save sys/sys/stacktrace.h:37 [inline] #0 witness_lock+0x5f1 sys/kern/subr_witness.c:1160 #1 rw_do_enter_write+0x419 sys/kern/kern_rwlock.c:320 #2 dt_ioctl_record_stop+0x2e sys/dev/dt/dt_dev.c:572 #3 dtclose+0x109 dt_pcb_purge sys/dev/dt/dt_dev.c:-1 [inline] #3 dtclose+0x109 sys/dev/dt/dt_dev.c:239 #4 spec_close+0x466 sys/kern/spec_vnops.c:-1 #5 VOP_CLOSE+0x132 sys/kern/vfs_vops.c:156 #6 vn_closefile+0x12b vn_close sys/kern/vfs_vnops.c:292 [inline] #6 vn_closefile+0x12b sys/kern/vfs_vnops.c:615 #7 fdrop+0x121 sys/kern/kern_descrip.c:1281 #8 closef+0x192 sys/kern/kern_descrip.c:1265 #9 syscall+0xbd4 mi_syscall sys/sys/syscall_mi.h:176 [inline] #9 syscall+0xbd4 sys/arch/amd64/amd64/trap.c:783 #10 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 0 (0xffffffff83aa4640) #0 witness_lock+0x5f1 stacktrace_save sys/sys/stacktrace.h:37 [inline] #0 witness_lock+0x5f1 sys/kern/subr_witness.c:1160 #1 vn_closefile+0x41 sys/kern/vfs_vnops.c:608 #2 fdrop+0x121 sys/kern/kern_descrip.c:1281 #3 closef+0x192 sys/kern/kern_descrip.c:1265 #4 syscall+0xbd4 mi_syscall sys/sys/syscall_mi.h:176 [inline] #4 syscall+0xbd4 sys/arch/amd64/amd64/trap.c:783 #5 Xsyscall+0x128 exclusive mutex &cq->cq_mtx r = 0 (0xffff8000299bee30) #0 witness_lock+0x5f1 stacktrace_save sys/sys/stacktrace.h:37 [inline] #0 witness_lock+0x5f1 sys/kern/subr_witness.c:1160 #1 mtx_enter+0x4b4 sys/kern/kern_lock.c:487 #2 clockintr_unbind+0x56 sys/kern/kern_clockintr.c:375 #3 dt_ioctl_record_stop+0xbc sys/dev/dt/dt_dev.c:589 #4 dtclose+0x109 dt_pcb_purge sys/dev/dt/dt_dev.c:-1 [inline] #4 dtclose+0x109 sys/dev/dt/dt_dev.c:239 #5 spec_close+0x466 sys/kern/spec_vnops.c:-1 #6 VOP_CLOSE+0x132 sys/kern/vfs_vops.c:156 #7 vn_closefile+0x12b vn_close sys/kern/vfs_vnops.c:292 [inline] #7 vn_closefile+0x12b sys/kern/vfs_vnops.c:615 #8 fdrop+0x121 sys/kern/kern_descrip.c:1281 #9 closef+0x192 sys/kern/kern_descrip.c:1265 #10 syscall+0xbd4 mi_syscall sys/sys/syscall_mi.h:176 [inline] #10 syscall+0xbd4 sys/arch/amd64/amd64/trap.c:783 #11 Xsyscall+0x128 Process 69055 (syz-executor) thread 0xffff80002a25bca0 (156172) exclusive rrwlock inode r = 0 (0xfffffd806c55b0c8) #0 witness_lock+0x5f1 stacktrace_save sys/sys/stacktrace.h:37 [inline] #0 witness_lock+0x5f1 sys/kern/subr_witness.c:1160 #1 rw_do_enter_write+0x419 sys/kern/kern_rwlock.c:320 #2 rrw_enter+0xc6 sys/kern/kern_rwlock.c:621 #3 VOP_LOCK+0xbd sys/kern/vfs_vops.c:527 #4 ufs_ihashins+0x4f ufs_ihash sys/ufs/ufs/ufs_ihash.c:-1 [inline] #4 ufs_ihashins+0x4f sys/ufs/ufs/ufs_ihash.c:159 #5 ffs_vget+0x187 sys/ufs/ffs/ffs_vfsops.c:1232 #6 ffs_inode_alloc+0x279 sys/ufs/ffs/ffs_alloc.c:393 #7 ufs_mkdir+0xfc sys/ufs/ufs/ufs_vnops.c:1112 #8 VOP_MKDIR+0x101 sys/kern/vfs_vops.c:394 #9 domkdirat+0x179 sys/kern/vfs_syscalls.c:3143 #10 syscall+0xb17 mi_syscall sys/sys/syscall_mi.h:176 [inline] #10 syscall+0xb17 sys/arch/amd64/amd64/trap.c:783 #11 Xsyscall+0x128 exclusive rrwlock inode r = 0 (0xfffffd806cfec430) #0 witness_lock+0x5f1 stacktrace_save sys/sys/stacktrace.h:37 [inline] #0 witness_lock+0x5f1 sys/kern/subr_witness.c:1160 #1 rw_do_enter_write+0x419 sys/kern/kern_rwlock.c:320 #2 rrw_enter+0xc6 sys/kern/kern_rwlock.c:621 #3 VOP_LOCK+0xbd sys/kern/vfs_vops.c:527 #4 vn_lock+0xa4 sys/kern/vfs_vnops.c:570 #5 vfs_lookup+0x11c sys/kern/vfs_lookup.c:-1 #6 namei+0x7ca sys/kern/vfs_lookup.c:250 #7 domkdirat+0x8b sys/kern/vfs_syscalls.c:3128 #8 syscall+0xb17 mi_syscall sys/sys/syscall_mi.h:176 [inline] #8 syscall+0xb17 sys/arch/amd64/amd64/trap.c:783 #9 Xsyscall+0x128 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 11121 12349K 13988K 166960K 14114 0 pcb 19 15K 16K 166960K 218 0 rtable 213 9K 10K 166960K 675 0 pf 36 18K 21K 166960K 199 0 ifaddr 39 6K 8K 166960K 119 0 ifgroup 53 2K 2K 166960K 196 0 sysctl 4 1K 9K 166960K 18 0 counters 74 37K 38K 166960K 220 0 ioctlops 0 0K 4K 166960K 1734 0 iov 0 0K 16K 166960K 108 0 mount 1 1K 1K 166960K 1 0 log 0 0K 0K 166960K 4 0 vnodes 1543 97K 97K 166960K 2593 0 UFS quota 1 32K 32K 166960K 1 0 UFS mount 5 36K 36K 166960K 5 0 shm 2 1K 9K 166960K 22 0 VM map 2 1K 1K 166960K 2 0 sem 25 17K 17K 166960K 82 0 dirhash 12 2K 2K 166960K 27 0 ACPI 1692 195K 286K 166960K 12470 0 file desc 16 57K 85K 166960K 1032 0 sigio 0 0K 0K 166960K 13 0 proc 22 33K 148K 166960K 723 0 subproc 72 4K 4K 166960K 99 0 NFS srvsock 1 0K 0K 166960K 1 0 NFS daemon 1 16K 16K 166960K 1 0 ip_moptions 0 0K 0K 166960K 98 0 in_multi 84 6K 7K 166960K 169 0 ether_multi 1 0K 0K 166960K 8 0 mrt 0 0K 0K 166960K 17 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 537 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 155 91K 191K 166960K 11411 0 UVM aobj 30 2K 2K 166960K 35 0 pinsyscall 22 44K 100K 166960K 2311 0 memdesc 1 4K 4K 166960K 1 0 crypto data 1 1K 1K 166960K 1 0 ip6_options 0 0K 0K 166960K 49 0 NDP 12 0K 1K 166960K 83 0 temp 75 9084K 9340K 166960K 32324 0 kqueue 4 6K 31K 166960K 195 0 SYN cache 2 16K 16K 166960K 2 0 ddb{0}>