witness: lock order reversal: 1st 0xfffffd806eeb9d10 vmmaplk (&map->lock) 2nd 0xfffffd806ab71c08 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{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:440 witness_checkorder(fffffd806ab71c08,9,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(fffffd806ab71c08,9,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_write(fffffd806ab71bf8) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:128 fill_file(ffff800000bce400,fffffd806e60f860,fffffd806ab71bb0,0,0,ffff80002132ba50,b9988002eff41ac1,fb,0) at fill_file+0xad2 sys/kern/kern_sysctl.c:1304 sysctl_file(ffff8000212f65e8,4,20000080,ffff8000212f6618,ffff8000ffff5a48) at sysctl_file+0x62d sys/kern/kern_sysctl.c:1457 kern_sysctl(ffff8000212f65e4,5,20000080,ffff8000212f6618,0,0,c0bfb9676b4d5d94) at kern_sysctl+0xfd sys/kern/kern_sysctl.c:449 sys_sysctl(ffff8000ffff5a48,ffff8000212f6688,ffff8000212f66e0) at sys_sysctl+0x209 sys/kern/kern_sysctl.c:249 syscall(ffff8000212f6750) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000212f6750) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xa08b61b1e0, count: -9 ddb{0}> show registers rdi 0x3 rsi 0xffffffff8294abb0 __sancov_gen_cov_switch_values.134 rbp 0xffff8000212f5f50 rbx 0x3 rdx 0x3fd rcx 0 rax 0x1 r8 0xffff8000212f5ec0 r9 0x8080808080808080 r10 0x64a7df236cc7bcd8 r11 0x7281a1cde2f7bd6b r12 0xffffffff82aad2b0 w_lodata+0x4f940 r13 0 r14 0xffffffff82aacd30 w_lodata+0x4f3c0 r15 0xfffffd8002f62c80 rip 0xffffffff8138d658 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff8000212f5f40 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.2) pid=463371 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=50, nice=20 forw=0xffffffffffffffff, list=0xffff8000ffff47e8,0xffff8000ffff4018 process=0xffff80002132a9b0 user=0xffff8000212f1000, vmspace=0xfffffd806eeb9cf8 estcpu=0, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 64655 263819 51545 0 2 0x100000 sh 80000 495693 37883 0 7 0x2 ifconfig 37883 333045 91830 0 3 0x10008a sigsusp sh 28844 7789 47474 0 2 0 syz-executor.4 28844 120228 47474 0 3 0x4000080 fsleep syz-executor.4 47982 29534 30385 0 2 0 syz-executor.2 *47982 463371 30385 0 7 0x4000000 syz-executor.2 99041 365500 77843 0 2 0x100000 sh 51545 26177 75211 0 2 0x100002 sh 70995 184667 27467 0 2 0x2 ifconfig 27467 93413 83386 0 3 0x10008a sigsusp sh 60135 179680 49477 0 2 0x100002 sh 4586 211038 71050 0 2 0x2 arp 77843 187812 49838 0 3 0x10008a sigsusp sh 71050 465811 89247 0 3 0x10008a sigsusp sh 49477 243654 17340 0 3 0x82 wait syz-executor.7 91830 320116 17340 0 3 0x82 wait syz-executor.1 83386 44709 17340 0 3 0x82 wait syz-executor.3 30385 465783 17340 0 3 0x82 nanoslp syz-executor.2 47474 370774 17340 0 3 0x82 nanoslp syz-executor.4 89247 289714 17340 0 3 0x82 wait syz-executor.5 75211 235629 17340 0 2 0x2 syz-executor.6 49838 411318 17340 0 3 0x82 wait syz-executor.0 17340 244055 27399 0 3 0x82 kqread syz-execprog 17340 18248 27399 0 3 0x4000082 thrsleep syz-execprog 17340 188329 27399 0 3 0x4000082 thrsleep syz-execprog 17340 36304 27399 0 3 0x4000082 thrsleep syz-execprog 17340 45614 27399 0 3 0x4000082 thrsleep syz-execprog 17340 408768 27399 0 3 0x4000082 thrsleep syz-execprog 17340 349705 27399 0 3 0x4000082 thrsleep syz-execprog 17340 482776 27399 0 3 0x4000082 thrsleep syz-execprog 17340 8099 27399 0 3 0x4000082 thrsleep syz-execprog 17340 76321 27399 0 3 0x4000082 thrsleep syz-execprog 27399 344338 70651 0 3 0x10008a sigsusp ksh 70651 200612 14011 0 3 0x9a kqread sshd 67982 237544 1 0 3 0x100083 ttyin getty 14011 279881 1 0 3 0x88 kqread sshd 29395 6388 36260 73 3 0x1100090 kqread syslogd 36260 297932 1 0 3 0x100082 netio syslogd 43634 137740 1 0 3 0x100080 kqread resolvd 20738 223399 91061 77 3 0x100092 kqread dhcpleased 11827 255610 91061 77 3 0x100092 kqread dhcpleased 91061 354144 1 0 3 0x80 kqread dhcpleased 8025 300171 0 0 3 0x14200 bored smr 19827 304153 0 0 2 0x14200 zerothread 37837 60603 0 0 3 0x14200 aiodoned aiodoned 42607 102734 0 0 3 0x14200 syncer update 14373 401185 0 0 3 0x14200 cleaner cleaner 9798 164175 0 0 3 0x14200 reaper reaper 30973 332658 0 0 3 0x14200 pgdaemon pagedaemon 15546 347667 0 0 3 0x14200 bored viomb 70082 114737 0 0 3 0x40014200 acpi0 acpi0 46208 121192 0 0 3 0x40014200 idle1 16229 296591 0 0 3 0x14200 bored softnet 33555 344417 0 0 3 0x14200 bored systqmp 79744 26180 0 0 3 0x14200 bored systq 16776 93806 0 0 3 0x40014200 bored softclock 14624 495429 0 0 3 0x40014200 idle0 1 72531 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 47982 (syz-executor.2) thread 0xffff8000ffff5a48 (463371) shared rwlock vmmaplk r = 0 (0xfffffd806eeb9d10) #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{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 10167 6406K 6419K 78643K 11257 0 pcb 13 8K 8K 78643K 13 0 rtable 170 4K 5K 78643K 248 0 ifaddr 72 14K 14K 78643K 73 0 counters 56 35K 35K 78643K 56 0 ioctlops 0 0K 2K 78643K 28 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 5 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 23 85K 93K 78643K 117 0 proc 62 87K 111K 78643K 422 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 in_multi 55 3K 3K 78643K 55 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 581 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 240 73K 73K 78643K 2838 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 18 1K 1K 78643K 18 0 temp 53 4692K 4753K 78643K 3821 0 kqueue 12 18K 18K 78643K 25 0 SYN cache 2 16K 16K 78643K 2 0 ddb{0}> 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 25 0 22 1 0 1 1 0 8 0 rtentry 112 77 0 1 3 0 3 3 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 16 0 0 1 0 1 1 0 8 0 inpcb 304 53 0 46 1 0 1 1 0 8 0 nd6 48 9 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 273 0 0 18 0 18 18 0 8 0 art_table 32 274 0 0 3 0 3 3 0 8 0 art_node 16 76 0 5 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 1471 0 48 89 0 89 89 0 8 0 ffsino 272 1471 0 48 95 0 95 95 0 8 0 nchpl 144 1720 0 57 62 0 62 62 0 8 0 uvmvnodes 80 1480 0 0 31 0 31 31 0 8 0 vnodes 224 1480 0 0 88 0 88 88 0 8 0 namei 1024 5536 0 5536 3 1 2 2 0 8 2 percpumem 16 40 0 0 1 0 1 1 0 8 0 scxspl 216 5273 0 5273 2 1 1 2 0 8 1 plimitpl 152 23 0 9 1 0 1 1 0 8 0 sigapl 424 396 0 348 6 0 6 6 0 8 0 futexpl 64 3 0 2 1 0 1 1 0 8 0 knotepl 120 106 0 0 4 0 4 4 0 8 0 kqueuepl 216 21 0 13 1 0 1 1 0 8 0 pipepl 336 127 0 99 4 1 3 3 0 8 0 fdescpl 496 382 0 348 6 1 5 5 0 8 0 filepl 152 1359 0 1230 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 64 0 54 1 0 1 1 0 8 0 zombiepl 144 348 0 348 2 1 1 1 0 8 1 processpl 1064 396 0 348 5 1 4 4 0 8 0 procpl 672 407 0 348 5 0 5 5 0 8 0 sockpl 480 111 0 88 4 0 4 4 0 8 1 mcl8k 8192 4 0 0 1 0 1 1 0 8 0 mcl4k 4096 3 0 0 1 0 1 1 0 8 0 mcl2k 2048 80 0 0 10 0 10 10 0 8 0 mtagpl 96 2 0 0 1 0 1 1 0 8 0 mbufpl 256 234 0 0 14 0 14 14 0 8 0 bufpl 288 3541 0 139 243 0 243 243 0 8 0 anonpl 24 54685 0 48679 48 3 45 45 0 186 8 amapchunkpl 152 5861 0 5353 21 1 20 20 0 158 0 amappl16 200 257 0 179 6 1 5 5 0 8 0 amappl15 192 92 0 82 1 0 1 1 0 8 0 amappl14 184 2 0 1 1 0 1 1 0 8 0 amappl13 176 96 0 86 1 0 1 1 0 8 0 amappl12 168 14 0 13 2 1 1 1 0 8 0 amappl11 160 62 0 48 1 0 1 1 0 8 0 amappl10 152 28 0 26 1 0 1 1 0 8 0 amappl9 144 440 0 436 1 0 1 1 0 8 0 amappl8 136 531 0 500 2 0 2 2 0 8 0 amappl7 128 109 0 97 1 0 1 1 0 8 0 amappl6 120 237 0 215 2 0 2 2 0 8 1 amappl5 112 181 0 169 1 0 1 1 0 8 0 amappl4 104 756 0 724 2 0 2 2 0 8 1 amappl3 96 158 0 145 1 0 1 1 0 8 0 amappl2 88 495 0 447 3 0 3 3 0 8 1 amappl1 80 10337 0 9730 21 3 18 18 0 8 4 amappl 88 2462 0 2275 5 0 5 5 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 382 0 348 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 382 0 348 1 0 1 1 0 8 0 vmmpekpl 168 8102 0 8080 2 0 2 2 0 8 0 vmmpepl 168 36255 0 34439 90 2 88 88 0 357 8 vmsppl 368 381 0 348 4 0 4 4 0 8 0 rwobjpl 56 11649 0 9144 40 0 40 40 0 8 4 pdppl 4096 771 0 696 96 17 79 79 0 8 4 pvpl 32 228359 0 218267 261 2 259 259 0 265 177 pmappl 248 381 0 348 4 1 3 3 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 586 0 21 17 0 17 17 0 8 0 ddb{0}> machine ddbcpu 0 Invalid cpu 0 ddb{0}> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:440 witness_checkorder(fffffd806ab71c08,9,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(fffffd806ab71c08,9,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_write(fffffd806ab71bf8) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:128 fill_file(ffff800000bce400,fffffd806e60f860,fffffd806ab71bb0,0,0,ffff80002132ba50,b9988002eff41ac1,fb,0) at fill_file+0xad2 sys/kern/kern_sysctl.c:1304 sysctl_file(ffff8000212f65e8,4,20000080,ffff8000212f6618,ffff8000ffff5a48) at sysctl_file+0x62d sys/kern/kern_sysctl.c:1457 kern_sysctl(ffff8000212f65e4,5,20000080,ffff8000212f6618,0,0,c0bfb9676b4d5d94) at kern_sysctl+0xfd sys/kern/kern_sysctl.c:449 sys_sysctl(ffff8000ffff5a48,ffff8000212f6688,ffff8000212f66e0) at sys_sysctl+0x209 sys/kern/kern_sysctl.c:249 syscall(ffff8000212f6750) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000212f6750) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xa08b61b1e0, count: -9 ddb{0}> machine ddbcpu 1 Stopped at x86_ipi_db+0x1a: addq $0x8,%rsp ddb{1}> trace x86_ipi_db(ffff800020ce8ff0) 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 __mp_lock(ffffffff829de780) at __mp_lock+0x122 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff829de780) at __mp_lock+0x122 sys/kern/kern_lock.c:147 syscall(ffff800021331270) at syscall+0x3ef mi_syscall sys/sys/syscall_mi.h:93 [inline] syscall(ffff800021331270) at syscall+0x3ef sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffbbe80, count: -6 ddb{1}>