witness: lock order reversal: 1st 0xfffffd8076f3f5e8 vmmaplk (&map->lock) 2nd 0xfffffd8067147a10 fdlock (&newfdp->fd_fd.fd_lock) lock order "&newfdp->fd_fd.fd_lock"(rwlock) -> "&map->lock"(rwlock) first seen at: #0 rw_enter_read+0x66 sys/kern/kern_rwlock.c:112 #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(fffffd8067147a10,9,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(fffffd8067147a10,9,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_write(fffffd8067147a00) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:128 fill_file(ffff800000ca5400,fffffd8067fdc8e8,fffffd80671479b8,0,0,ffff80002bd3d910,46a93f5be8fecf2e,7,0) at fill_file+0xad2 sys/kern/kern_sysctl.c:1304 sysctl_file(ffff800021214c98,4,20000080,ffff800021214cc8,ffff80002c556a88) at sysctl_file+0x62d sys/kern/kern_sysctl.c:1457 kern_sysctl(ffff800021214c94,5,20000080,ffff800021214cc8,0,0,25bddefb0046f68) at kern_sysctl+0xfd sys/kern/kern_sysctl.c:449 sys_sysctl(ffff80002c556a88,ffff800021214d38,ffff800021214d90) at sys_sysctl+0x209 sys/kern/kern_sysctl.c:249 syscall(ffff800021214e00) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff800021214e00) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xd39d030b300, count: -9 ddb{1}> show registers rdi 0x3 rsi 0x40000 acpi_pdirpa+0x2be68 rbp 0xffff800021214600 rbx 0x3 rdx 0xffff800000bc2140 rcx 0 rax 0x3ffff acpi_pdirpa+0x2be67 r8 0xffff800021214570 r9 0x8080808080808080 r10 0x3d10ac9c98e711c0 r11 0xa860ea8d7d37be01 r12 0xffffffff82aacc80 w_lodata+0x4f310 r13 0 r14 0xffffffff82aa2fc0 w_lodata+0x45650 r15 0xfffffd8002f62c80 rip 0xffffffff8138d658 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff8000212145f0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.2) pid=235298 stat=onproc flags process=10 proc=4000000 pri=32, usrpri=68, nice=20 forw=0xffffffffffffffff, list=0xffff8000fffefa48,0xffffffff82b3d400 process=0xffff80002bd3c020 user=0xffff80002120f000, vmspace=0xfffffd8076f3f5d0 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 55930 12527 65933 32767 2 0x10 syz-executor.6 55930 523068 65933 32767 2 0x4000010 syz-executor.6 57269 485827 94703 32767 2 0x10 syz-executor.5 57269 161735 94703 32767 3 0x4000090 fsleep syz-executor.5 38260 186912 22431 32767 2 0x10 syz-executor.3 97252 126121 74521 32767 2 0x10 syz-executor.0 22458 416303 88295 32767 7 0x10 syz-executor.2 *22458 235298 88295 32767 7 0x4000010 syz-executor.2 95171 33950 3620 32767 2 0x10 syz-executor.4 7077 510109 60818 32767 2 0x10 syz-executor.1 22431 94812 14799 32767 2 0x10 syz-executor.3 14799 242253 93857 0 3 0x82 wait syz-executor.3 74521 417401 99358 32767 3 0x90 nanoslp syz-executor.0 99358 497850 93857 0 3 0x82 wait syz-executor.0 42660 56775 0 0 3 0x14200 bored sosplice 65933 302206 57904 32767 3 0x90 nanoslp syz-executor.6 3620 396427 3288 32767 3 0x90 nanoslp syz-executor.4 38786 507150 67032 32767 2 0x10 syz-executor.7 3288 138804 93857 0 3 0x82 wait syz-executor.4 67032 465802 93857 0 3 0x82 wait syz-executor.7 94703 71356 52796 32767 3 0x90 nanoslp syz-executor.5 57904 462042 93857 0 3 0x82 wait syz-executor.6 52796 257969 93857 0 3 0x82 wait syz-executor.5 60818 193402 55653 32767 3 0x90 nanoslp syz-executor.1 88295 465789 49042 32767 3 0x90 nanoslp syz-executor.2 55653 311016 93857 0 3 0x82 wait syz-executor.1 49042 399883 93857 0 3 0x82 wait syz-executor.2 93857 105937 36817 0 3 0x82 kqread syz-fuzzer 93857 239217 36817 0 3 0x4000082 thrsleep syz-fuzzer 93857 121780 36817 0 3 0x4000082 thrsleep syz-fuzzer 93857 347928 36817 0 3 0x4000082 thrsleep syz-fuzzer 93857 312904 36817 0 3 0x4000082 thrsleep syz-fuzzer 93857 352362 36817 0 3 0x4000082 thrsleep syz-fuzzer 93857 141180 36817 0 3 0x4000082 thrsleep syz-fuzzer 93857 281781 36817 0 3 0x4000082 thrsleep syz-fuzzer 36817 17709 6305 0 3 0x10008a sigsusp ksh 6305 437460 80595 0 3 0x9a kqread sshd 41920 298862 1 0 3 0x100083 ttyin getty 80595 178438 1 0 3 0x88 kqread sshd 7974 371109 32747 73 3 0x1100090 kqread syslogd 32747 451431 1 0 3 0x100082 netio syslogd 73445 257440 1 0 3 0x100080 kqread resolvd 42681 229951 21215 77 3 0x100092 kqread dhcpleased 68348 245062 21215 77 3 0x100092 kqread dhcpleased 21215 428882 1 0 3 0x80 kqread dhcpleased 5660 154207 0 0 3 0x14200 bored smr 59630 386723 0 0 2 0x14200 zerothread 51254 88076 0 0 3 0x14200 aiodoned aiodoned 58433 331596 0 0 3 0x14200 syncer update 6763 80293 0 0 3 0x14200 cleaner cleaner 30614 389535 0 0 3 0x14200 reaper reaper 58948 361353 0 0 3 0x14200 pgdaemon pagedaemon 48247 436127 0 0 3 0x14200 bored viomb 56436 123194 0 0 3 0x40014200 acpi0 acpi0 21558 204878 0 0 3 0x40014200 idle1 68735 140126 0 0 3 0x14200 bored softnet 26134 312441 0 0 3 0x14200 bored systqmp 90976 3861 0 0 3 0x14200 bored systq 38785 271590 0 0 3 0x40014200 bored softclock 65658 276213 0 0 3 0x40014200 idle0 1 346273 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 22458 (syz-executor.2) thread 0xffff80002c556a88 (235298) shared rwlock vmmaplk r = 0 (0xfffffd8076f3f5e8) #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 10191 6409K 6419K 78643K 11294 0 pcb 13 10K 12K 78643K 15 0 rtable 262 7K 7K 78643K 892 0 ifaddr 81 16K 16K 78643K 110 0 counters 56 35K 35K 78643K 64 0 ioctlops 0 0K 2K 78643K 236 0 iov 0 0K 32K 78643K 794 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 4 0 vnodes 1271 79K 79K 78643K 2230 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 13K 78643K 73 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 0K 78643K 1332 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 25 93K 113K 78643K 5856 0 sigio 0 0K 0K 78643K 348 0 proc 56 74K 111K 78643K 915 0 subproc 104 6K 6K 78643K 156 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 556 0 in_multi 99 6K 6K 78643K 177 0 ether_multi 1 0K 0K 78643K 9 0 mrt 3 0K 0K 78643K 3 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 163 731K 731K 78643K 163 0 exec 0 0K 2K 78643K 1523 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 354 90K 106K 78643K 76310 0 UVM aobj 131 6K 6K 78643K 131 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 179 0 NDP 11 0K 2K 78643K 39 0 temp 126 4708K 4771K 78643K 17227 0 kqueue 12 18K 26K 78643K 523 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 725 0 722 11 10 1 3 0 8 0 rtentry 112 171 0 49 4 0 4 4 0 8 0 unpcb 136 9352 0 9339 50 49 1 9 0 8 0 syncache 296 50 0 50 12 12 0 1 0 8 0 tcpqe 32 6 0 6 3 3 0 1 0 8 0 tcpcb 736 1745 0 1738 54 53 1 14 0 8 0 arp 120 27 0 8 1 0 1 1 0 8 0 ipq 40 8 0 8 5 5 0 1 0 8 0 ipqe 40 126 0 126 5 5 0 1 0 8 0 inpcb 304 4439 0 4428 59 56 3 14 0 8 0 rttmr 72 9 0 7 1 0 1 1 0 8 0 ip6q 72 39 0 36 1 0 1 1 0 8 0 ip6af 40 75 0 72 1 0 1 1 0 8 0 nd6 48 49 0 16 1 0 1 1 0 8 0 kcovpl 48 12 0 4 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 740 0 195 36 1 35 35 0 8 0 art_table 32 741 0 195 5 0 5 5 0 8 0 art_node 16 170 0 58 1 0 1 1 0 8 0 sysvmsgpl 40 17 0 11 1 0 1 1 0 8 0 semapl 112 1330 0 1320 1 0 1 1 0 8 0 shmpl 112 128 0 0 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 8879 0 7442 91 0 91 91 0 8 0 ffsino 272 8879 0 7442 97 0 97 97 0 8 0 nchpl 144 16821 0 15198 62 0 62 62 0 8 0 uvmvnodes 80 5926 0 0 121 0 121 121 0 8 0 vnodes 224 5926 0 0 349 0 349 349 0 8 0 namei 1024 53961 0 53961 4 3 1 2 0 8 1 percpumem 16 44 0 4 1 0 1 1 0 8 0 scxspl 216 54598 0 54598 21 20 1 8 0 8 1 plimitpl 152 1162 0 1140 4 2 2 2 0 8 1 sigapl 424 6138 0 6087 7 1 6 7 0 8 0 futexpl 64 43912 0 43911 2 1 1 1 0 8 0 knotepl 120 404 0 0 11 5 6 11 0 8 0 kqueuepl 216 1542 0 1534 28 27 1 7 0 8 0 pipepl 336 1358 0 1329 44 41 3 13 0 8 0 fdescpl 496 6123 0 6087 7 2 5 6 0 8 0 filepl 152 39716 0 39480 89 79 10 19 0 8 0 lockfpl 104 557 0 555 1 0 1 1 0 8 0 lockfspl 48 177 0 175 1 0 1 1 0 8 0 sessionpl 144 27 0 11 1 0 1 1 0 8 0 pgrppl 48 39 0 23 1 0 1 1 0 8 0 ucredpl 96 5560 0 5542 1 0 1 1 0 8 0 zombiepl 144 6087 0 6087 1 0 1 1 0 8 1 processpl 1064 6138 0 6087 5 1 4 4 0 8 0 procpl 672 16963 0 16902 16 9 7 8 0 8 1 sosppl 168 48 0 48 7 7 0 1 0 8 0 sockpl 480 14734 0 14711 271 266 5 34 0 8 2 mcl64k 65536 23 0 0 3 0 3 3 0 8 0 mcl16k 16384 20 0 0 3 1 2 3 0 8 0 mcl12k 12288 17 0 0 2 0 2 2 0 8 0 mcl9k 9216 10 0 0 1 0 1 1 0 8 0 mcl8k 8192 26 0 0 4 1 3 3 0 8 0 mcl4k 4096 25 0 0 4 1 3 3 0 8 0 mcl2k2 2112 5 0 0 1 0 1 1 0 8 0 mcl2k 2048 212 0 0 19 2 17 19 0 8 0 mtagpl 96 2 0 0 1 0 1 1 0 8 0 mbufpl 256 9100 0 0 552 0 552 552 0 8 0 bufpl 288 12229 0 5894 453 0 453 453 0 8 0 anonpl 24 1676606 0 1662853 194 97 97 119 0 186 0 amapchunkpl 152 193386 0 192641 125 90 35 49 0 158 1 amappl16 200 15199 0 14850 68 47 21 33 0 8 0 amappl15 192 2868 0 2858 1 0 1 1 0 8 0 amappl14 184 625 0 623 1 0 1 1 0 8 0 amappl13 176 795 0 790 1 0 1 1 0 8 0 amappl12 168 728 0 722 1 0 1 1 0 8 0 amappl11 160 1468 0 1453 1 0 1 1 0 8 0 amappl10 152 32 0 30 1 0 1 1 0 8 0 amappl9 144 454 0 452 1 0 1 1 0 8 0 amappl8 136 985 0 882 4 0 4 4 0 8 0 amappl7 128 259 0 248 1 0 1 1 0 8 0 amappl6 120 226 0 197 2 0 2 2 0 8 0 amappl5 112 3495 0 3477 1 0 1 1 0 8 0 amappl4 104 3785 0 3747 2 0 2 2 0 8 0 amappl3 96 1923 0 1907 1 0 1 1 0 8 0 amappl2 88 2232 0 2186 3 1 2 3 0 8 0 amappl1 80 111675 0 111076 23 8 15 18 0 8 0 amappl 88 75604 0 75361 7 0 7 7 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 130 0 0 3 0 3 3 0 8 0 uaddrrnd 24 6123 0 6087 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 6123 0 6087 1 0 1 1 0 8 0 vmmpekpl 168 51630 0 51585 3 0 3 3 0 8 0 vmmpepl 168 553111 0 550490 189 64 125 136 0 357 5 vmsppl 368 6122 0 6087 4 0 4 4 0 8 0 rwobjpl 56 138745 0 131386 116 10 106 109 0 8 0 pdppl 4096 12253 0 12174 223 142 81 89 0 8 2 pvpl 32 2861820 0 2842937 388 217 171 258 0 265 2 pmappl 248 6122 0 6087 4 1 3 3 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 1598 0 247 39 0 39 39 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 __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 intr_handler(ffff80002e3b9540,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+0x129 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff829de780) at __mp_lock+0x129 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: 0x7f7ffffef500, 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(fffffd8067147a10,9,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(fffffd8067147a10,9,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_write(fffffd8067147a00) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:128 fill_file(ffff800000ca5400,fffffd8067fdc8e8,fffffd80671479b8,0,0,ffff80002bd3d910,46a93f5be8fecf2e,7,0) at fill_file+0xad2 sys/kern/kern_sysctl.c:1304 sysctl_file(ffff800021214c98,4,20000080,ffff800021214cc8,ffff80002c556a88) at sysctl_file+0x62d sys/kern/kern_sysctl.c:1457 kern_sysctl(ffff800021214c94,5,20000080,ffff800021214cc8,0,0,25bddefb0046f68) at kern_sysctl+0xfd sys/kern/kern_sysctl.c:449 sys_sysctl(ffff80002c556a88,ffff800021214d38,ffff800021214d90) at sys_sysctl+0x209 sys/kern/kern_sysctl.c:249 syscall(ffff800021214e00) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff800021214e00) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xd39d030b300, count: -9