witness: lock order reversal: 1st 0xfffffd806c367198 vmmaplk (&map->lock) 2nd 0xfffffd807c64f058 fdlock (&newfdp->fd_fd.fd_lock) lock order "&newfdp->fd_fd.fd_lock"(rwlock) -> "&map->lock"(rwlock) first seen at: #0 rw_enter+0xd1 sys/kern/kern_rwlock.c:250 #1 uvmfault_lookup+0xd9 sys/uvm/uvm_fault.c:1758 #2 uvm_fault_check+0x3a sys/uvm/uvm_fault.c:674 #3 uvm_fault+0x102 sys/uvm/uvm_fault.c:602 #4 kpageflttrap+0x209 #5 kerntrap+0xef sys/arch/amd64/amd64/trap.c:318 #6 alltraps_kern_meltdown+0x7b #7 copyout+0x53 #8 syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] #8 syscall+0x489 sys/arch/amd64/amd64/trap.c:585 #9 Xsyscall+0x128 lock order "&map->lock"(rwlock) -> "&newfdp->fd_fd.fd_lock"(rwlock) first seen at: #0 rw_enter_write+0x5b sys/kern/kern_rwlock.c:128 #1 fill_file+0xad2 sys/kern/kern_sysctl.c:1304 #2 sysctl_file+0x62d sys/kern/kern_sysctl.c:1457 #3 kern_sysctl+0xfd sys/kern/kern_sysctl.c:449 #4 sys_sysctl+0x209 sys/kern/kern_sysctl.c:249 #5 syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] #5 syscall+0x489 sys/arch/amd64/amd64/trap.c:585 #6 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:440 witness_checkorder(fffffd807c64f058,9,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(fffffd807c64f058,9,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_write(fffffd807c64f048) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:128 fill_file(ffff800000b93c00,fffffd806ef7bc80,fffffd807c64f000,0,0,ffff8000ffff1d30,8da4039540c43ff0,4a00,0) at fill_file+0xad2 sys/kern/kern_sysctl.c:1304 sysctl_file(ffff800021340fc8,4,20000080,ffff800021340ff8,ffff80002135c2b0) at sysctl_file+0x62d sys/kern/kern_sysctl.c:1457 kern_sysctl(ffff800021340fc4,5,20000080,ffff800021340ff8,0,0,382272a16ea8c75e) at kern_sysctl+0xfd sys/kern/kern_sysctl.c:449 sys_sysctl(ffff80002135c2b0,ffff800021341068,ffff8000213410c0) at sys_sysctl+0x209 sys/kern/kern_sysctl.c:249 syscall(ffff800021341130) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff800021341130) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x9510842cfd0, count: -9 ddb{1}> show registers rdi 0x3 rsi 0xffffffff8294abb0 __sancov_gen_cov_switch_values.134 rbp 0xffff800021340930 rbx 0x3 rdx 0x3fd rcx 0 rax 0x1 r8 0xffff8000213408a0 r9 0x8080808080808080 r10 0x35a6795bc3ccba55 r11 0xe0449119d411a2eb r12 0xffffffff82aad360 w_lodata+0x4f9f0 r13 0 r14 0xffffffff82aac860 w_lodata+0x4eef0 r15 0xfffffd8002f62c80 rip 0xffffffff8138d658 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800021340920 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.5) pid=223871 stat=onproc flags process=10 proc=4000000 pri=32, usrpri=50, nice=20 forw=0xffffffffffffffff, list=0xffff80002135da50,0xffffffff82b3d400 process=0xffff8000ffff14e0 user=0xffff80002133c000, vmspace=0xfffffd806c367180 estcpu=0, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 59603 12988 76683 0 2 0x2 sh 56021 183717 3254 32767 7 0x10 syz-executor.5 *56021 223871 3254 32767 7 0x4000010 syz-executor.5 13462 87785 26760 0 2 0x40 syz-executor.4 57677 523966 56638 0 2 0x2 sh 56638 243984 16278 0 3 0x80 wait syz-executor.3 62502 456806 90587 0 2 0x100002 sh 26760 436200 85761 0 3 0x80 ppwait syz-executor.4 9810 151561 60423 0 2 0x100002 sh 68847 66964 20697 0 2 0x2 ifconfig 16278 218080 97802 0 3 0x82 wait syz-executor.3 20697 268945 17821 0 3 0x10008a sigsusp sh 85761 313669 97802 0 3 0x82 wait syz-executor.4 3254 9514 22252 32767 3 0x90 nanoslp syz-executor.5 90587 151912 65158 0 3 0x80 wait syz-executor.2 68092 47453 99235 0 2 0 syz-executor.1 65158 457940 97802 0 3 0x82 wait syz-executor.2 60423 182194 18567 0 3 0x80 wait syz-executor.7 22252 393789 97802 0 3 0x82 wait syz-executor.5 99235 83891 97802 0 3 0x82 wait syz-executor.1 76683 493615 92048 0 3 0x80 wait syz-executor.6 18567 54614 97802 0 3 0x82 wait syz-executor.7 17821 174036 58227 0 3 0x80 wait syz-executor.0 92048 495067 97802 0 3 0x82 wait syz-executor.6 58227 319900 97802 0 3 0x82 wait syz-executor.0 97802 77188 86591 0 3 0x82 thrsleep syz-execprog 97802 210605 86591 0 3 0x4000082 nanoslp syz-execprog 97802 164594 86591 0 3 0x4000082 thrsleep syz-execprog 97802 232915 86591 0 3 0x4000082 thrsleep syz-execprog 97802 121963 86591 0 3 0x4000082 thrsleep syz-execprog 97802 259910 86591 0 3 0x4000082 kqread syz-execprog 97802 42378 86591 0 3 0x4000082 thrsleep syz-execprog 97802 71201 86591 0 3 0x4000082 thrsleep syz-execprog 97802 507815 86591 0 3 0x4000082 thrsleep syz-execprog 97802 35659 86591 0 3 0x4000082 thrsleep syz-execprog 86591 234591 64401 0 3 0x10008a sigsusp ksh 64401 339212 98416 0 3 0x9a kqread sshd 85205 161527 1 0 3 0x100083 ttyin getty 98416 481502 1 0 3 0x88 kqread sshd 1260 497740 99611 73 3 0x1100090 kqread syslogd 99611 314546 1 0 3 0x100082 netio syslogd 8868 418353 1 0 3 0x100080 kqread resolvd 78602 386763 60229 77 3 0x100092 kqread dhcpleased 24298 523627 60229 77 3 0x100092 kqread dhcpleased 60229 42968 1 0 3 0x80 kqread dhcpleased 34492 442586 0 0 3 0x14200 bored smr 8116 442614 0 0 2 0x14200 zerothread 82011 282254 0 0 3 0x14200 aiodoned aiodoned 92537 155243 0 0 3 0x14200 syncer update 93977 97345 0 0 3 0x14200 cleaner cleaner 34404 161062 0 0 3 0x14200 reaper reaper 50852 483919 0 0 3 0x14200 pgdaemon pagedaemon 84936 484932 0 0 3 0x14200 bored viomb 82325 51772 0 0 3 0x40014200 acpi0 acpi0 14234 145820 0 0 3 0x40014200 idle1 77091 297545 0 0 3 0x14200 bored softnet 30076 32016 0 0 3 0x14200 bored systqmp 70920 332503 0 0 3 0x14200 bored systq 35116 478857 0 0 3 0x40014200 bored softclock 9245 504251 0 0 3 0x40014200 idle0 1 493328 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 56021 (syz-executor.5) thread 0xffff80002135c2b0 (223871) shared rwlock vmmaplk r = 0 (0xfffffd806c367198) #0 witness_lock+0x44d #1 uvm_vslock+0xc8 sys/uvm/uvm_glue.c:129 #2 sys_sysctl+0x2d8 sys/kern/kern_sysctl.c:240 #3 syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] #3 syscall+0x489 sys/arch/amd64/amd64/trap.c:585 #4 Xsyscall+0x128 exclusive rwlock sysctllk r = 0 (0xffffffff82941f10) #0 witness_lock+0x44d #1 rw_enter+0x3e1 sys/kern/kern_rwlock.c:310 #2 sys_sysctl+0x1b3 sys/kern/kern_sysctl.c:233 #3 syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] #3 syscall+0x489 sys/arch/amd64/amd64/trap.c:585 #4 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 0 (0xffffffff829de988) #0 witness_lock+0x44d #1 syscall+0x3ef mi_syscall sys/sys/syscall_mi.h:93 [inline] #1 syscall+0x3ef sys/arch/amd64/amd64/trap.c:585 #2 Xsyscall+0x128 ddb{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 10164 6404K 6419K 78643K 11254 0 pcb 13 8K 8K 78643K 13 0 rtable 116 3K 3K 78643K 194 0 ifaddr 60 12K 12K 78643K 61 0 counters 54 35K 35K 78643K 54 0 ioctlops 0 0K 2K 78643K 26 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 4 0 vnodes 1166 73K 73K 78643K 1179 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 1K 78643K 2 0 VM map 2 1K 1K 78643K 2 0 sem 2 0K 0K 78643K 2 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 26 97K 110K 78643K 97 0 proc 56 74K 111K 78643K 360 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 in_multi 26 1K 1K 78643K 26 0 ether_multi 1 0K 0K 78643K 1 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 25 122K 122K 78643K 25 0 exec 0 0K 2K 78643K 558 0 tdb 3 0K 0K 78643K 3 0 pagedep 1 8K 8K 78643K 1 0 inodedep 1 32K 32K 78643K 1 0 newblk 1 0K 0K 78643K 1 0 VM swap 7 26K 26K 78643K 7 0 UVM amap 215 73K 73K 78643K 2741 0 UVM aobj 3 2K 2K 78643K 3 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 NDP 12 0K 0K 78643K 12 0 temp 49 4692K 4753K 78643K 3849 0 kqueue 12 18K 18K 78643K 25 0 SYN cache 2 16K 16K 78643K 2 0 ddb{1}> show all pools Name Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle plcache 128 22 0 0 1 0 1 1 0 8 0 rtpcb 120 27 0 24 1 0 1 1 0 8 0 rtentry 112 50 0 1 2 0 2 2 0 8 0 unpcb 136 33 0 20 1 0 1 1 0 8 0 syncache 296 5 0 5 2 1 1 1 0 8 1 tcpcb 736 8 0 5 1 0 1 1 0 8 0 arp 120 12 0 0 1 0 1 1 0 8 0 inpcb 304 44 0 38 1 0 1 1 0 8 0 nd6 48 3 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 160 0 0 10 0 10 10 0 8 0 art_table 32 161 0 0 2 0 2 2 0 8 0 art_node 16 49 0 3 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 1470 0 48 89 0 89 89 0 8 0 ffsino 272 1470 0 48 95 0 95 95 0 8 0 nchpl 144 1718 0 57 62 0 62 62 0 8 0 uvmvnodes 80 1479 0 0 31 0 31 31 0 8 0 vnodes 224 1479 0 0 87 0 87 87 0 8 0 namei 1024 5383 0 5383 3 1 2 2 0 8 2 percpumem 16 39 0 0 1 0 1 1 0 8 0 scxspl 216 5504 0 5504 14 13 1 8 0 8 1 plimitpl 152 31 0 9 1 0 1 1 0 8 0 sigapl 424 391 0 340 7 0 7 7 0 8 0 futexpl 64 1 0 1 1 0 1 1 0 8 1 knotepl 120 102 0 0 4 0 4 4 0 8 0 kqueuepl 216 21 0 13 1 0 1 1 0 8 0 pipepl 336 131 0 103 4 1 3 3 0 8 0 fdescpl 496 377 0 340 7 1 6 6 0 8 0 filepl 152 1360 0 1233 6 0 6 6 0 8 1 lockfpl 104 6 0 4 1 0 1 1 0 8 0 lockfspl 48 4 0 2 1 0 1 1 0 8 0 sessionpl 144 25 0 9 1 0 1 1 0 8 0 pgrppl 48 25 0 9 1 0 1 1 0 8 0 ucredpl 96 67 0 56 1 0 1 1 0 8 0 zombiepl 144 340 0 340 2 1 1 1 0 8 1 processpl 1064 391 0 340 5 1 4 4 0 8 0 procpl 672 401 0 340 6 0 6 6 0 8 0 sockpl 480 104 0 82 4 0 4 4 0 8 1 mcl8k 8192 5 0 0 1 0 1 1 0 8 0 mcl4k 4096 2 0 0 1 0 1 1 0 8 0 mcl2k 2048 56 0 0 7 0 7 7 0 8 0 mtagpl 96 4 0 0 1 0 1 1 0 8 0 mbufpl 256 280 0 0 17 0 17 17 0 8 0 bufpl 288 3549 0 143 244 0 244 244 0 8 0 anonpl 24 52887 0 47785 49 5 44 44 0 186 9 amapchunkpl 152 5561 0 5112 21 1 20 20 0 158 1 amappl16 200 209 0 134 6 1 5 5 0 8 0 amappl15 192 91 0 84 1 0 1 1 0 8 0 amappl14 184 6 0 5 1 0 1 1 0 8 0 amappl13 176 78 0 72 2 1 1 1 0 8 0 amappl12 168 18 0 14 2 1 1 1 0 8 0 amappl11 160 61 0 45 1 0 1 1 0 8 0 amappl10 152 42 0 37 2 1 1 1 0 8 0 amappl9 144 442 0 436 1 0 1 1 0 8 0 amappl8 136 501 0 471 2 0 2 2 0 8 0 amappl7 128 105 0 95 1 0 1 1 0 8 0 amappl6 120 227 0 205 2 0 2 2 0 8 1 amappl5 112 178 0 166 1 0 1 1 0 8 0 amappl4 104 736 0 705 2 0 2 2 0 8 1 amappl3 96 163 0 150 1 0 1 1 0 8 0 amappl2 88 503 0 461 3 0 3 3 0 8 1 amappl1 80 10099 0 9570 21 3 18 18 0 8 4 amappl 88 2374 0 2207 4 0 4 4 0 92 0 dma4096 4096 1 0 1 1 1 0 1 0 8 0 dma1024 1024 1 0 0 1 0 1 1 0 8 0 dma256 256 6 0 6 1 1 0 1 0 8 0 dma128 128 253 0 253 1 1 0 1 0 8 0 dma64 64 6 0 6 1 1 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 2 0 0 1 0 1 1 0 8 0 uaddrrnd 24 377 0 340 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 377 0 340 1 0 1 1 0 8 0 vmmpekpl 168 8073 0 8051 2 0 2 2 0 8 0 vmmpepl 168 35551 0 33714 96 4 92 92 0 357 6 vmsppl 368 376 0 340 4 0 4 4 0 8 0 rwobjpl 56 11315 0 8942 40 0 40 40 0 8 4 pdppl 4096 761 0 680 115 26 89 89 0 8 8 pvpl 32 226180 0 217111 268 9 259 260 0 265 181 pmappl 248 376 0 340 4 1 3 3 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 598 0 30 17 0 17 17 0 8 0 ddb{1}> machine ddbcpu 0 Stopped at x86_ipi_db+0x1a: addq $0x8,%rsp ddb{0}> trace x86_ipi_db(ffffffff829baff0) at x86_ipi_db+0x1a sys/arch/amd64/amd64/db_interface.c:393 x86_ipi_handler() at x86_ipi_handler+0xb7 sys/arch/amd64/amd64/ipi.c:106 Xresume_lapic_ipi() at Xresume_lapic_ipi+0x23 __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x39 sys/dev/kcov.c:154 intr_handler(ffff8000213224a0,ffff800000077500) at intr_handler+0x5e sys/arch/amd64/amd64/intr.c:532 Xintr_ioapic_edge16_untramp() at Xintr_ioapic_edge16_untramp+0x18f __mp_lock(ffffffff829de780) at __mp_lock+0x133 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff829de780) at __mp_lock+0x133 sys/kern/kern_lock.c:147 softintr_dispatch(0) at softintr_dispatch+0x4e sys/arch/amd64/amd64/softintr.c:88 Xsoftclock() at Xsoftclock+0x1f end of kernel end trace frame: 0x7f7fffff9fa0, count: -9 ddb{0}> machine ddbcpu 1 Stopped at db_enter+0x18: addq $0x8,%rsp ddb{1}> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:440 witness_checkorder(fffffd807c64f058,9,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(fffffd807c64f058,9,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_write(fffffd807c64f048) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:128 fill_file(ffff800000b93c00,fffffd806ef7bc80,fffffd807c64f000,0,0,ffff8000ffff1d30,8da4039540c43ff0,4a00,0) at fill_file+0xad2 sys/kern/kern_sysctl.c:1304 sysctl_file(ffff800021340fc8,4,20000080,ffff800021340ff8,ffff80002135c2b0) at sysctl_file+0x62d sys/kern/kern_sysctl.c:1457 kern_sysctl(ffff800021340fc4,5,20000080,ffff800021340ff8,0,0,382272a16ea8c75e) at kern_sysctl+0xfd sys/kern/kern_sysctl.c:449 sys_sysctl(ffff80002135c2b0,ffff800021341068,ffff8000213410c0) at sys_sysctl+0x209 sys/kern/kern_sysctl.c:249 syscall(ffff800021341130) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff800021341130) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x9510842cfd0, count: -9