witness: lock order reversal: 1st 0xfffffd80696aaa40 vmmaplk (&map->lock) 2nd 0xfffffd80693eec00 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{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(fffffd80693eec00,9,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(fffffd80693eec00,9,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_write(fffffd80693eebf0) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:128 fill_file(ffff800000c43000,fffffd80673fa318,fffffd80693eeba8,0,0,ffff8000fffeb200,57c774a2a75eef53,2,0) at fill_file+0xad2 sys/kern/kern_sysctl.c:1304 sysctl_file(ffff80002120e3f8,4,20000080,ffff80002120e428,ffff8000fffefa48) at sysctl_file+0x62d sys/kern/kern_sysctl.c:1457 kern_sysctl(ffff80002120e3f4,5,20000080,ffff80002120e428,0,0,846b93db47503f05) at kern_sysctl+0xfd sys/kern/kern_sysctl.c:449 sys_sysctl(ffff8000fffefa48,ffff80002120e498,ffff80002120e4f0) at sys_sysctl+0x209 sys/kern/kern_sysctl.c:249 syscall(ffff80002120e560) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002120e560) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x92e7de533e0, count: -9 ddb{0}> show registers rdi 0x3 rsi 0x40000 acpi_pdirpa+0x2be68 rbp 0xffff80002120dd60 rbx 0x3 rdx 0xffff800000bdf740 rcx 0 rax 0x3ffff acpi_pdirpa+0x2be67 r8 0xffff80002120dcd0 r9 0x8080808080808080 r10 0x1c9171445dee22c3 r11 0x1fd1cca277d30730 r12 0xffffffff82aab730 w_lodata+0x4ddc0 r13 0 r14 0xffffffff82aa7530 w_lodata+0x49bc0 r15 0xfffffd8002f62c80 rip 0xffffffff8138d658 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff80002120dd50 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.1) pid=44004 stat=onproc flags process=10 proc=4000000 pri=32, usrpri=81, nice=20 forw=0xffffffffffffffff, list=0xffff8000fffef268,0xffff800021142558 process=0xffff8000fffe8448 user=0xffff800021209000, vmspace=0xfffffd80696aaa28 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 90348 102877 77266 32767 2 0x10 syz-executor.0 90348 55859 77266 32767 2 0x4000010 syz-executor.0 43000 444589 40625 32767 2 0x10 syz-executor.2 43000 299495 40625 32767 7 0x4000010 syz-executor.2 11064 380825 42517 32767 2 0x10 syz-executor.1 *11064 44004 42517 32767 7 0x4000010 syz-executor.1 72116 205619 10402 32767 2 0x10 syz-executor.5 72116 410696 10402 32767 3 0x4000090 fsleep syz-executor.5 72116 46682 10402 32767 3 0x4000090 fsleep syz-executor.5 72116 65145 10402 32767 3 0x4000090 fsleep syz-executor.5 50208 168436 42900 32767 2 0x10 syz-executor.4 50208 349288 42900 32767 3 0x4000090 fsleep syz-executor.4 55822 132787 2322 32767 3 0x90 nanoslp syz-executor.3 55822 148281 2322 32767 3 0x4000090 ttyout syz-executor.3 55822 295338 2322 32767 3 0x4000090 fsleep syz-executor.3 42517 450788 84062 32767 3 0x90 nanoslp syz-executor.1 84062 465018 97763 0 3 0x82 wait syz-executor.1 84441 221361 0 0 3 0x14200 bored sosplice 42900 202924 32920 32767 3 0x90 nanoslp syz-executor.4 10402 423097 48480 32767 3 0x90 nanoslp syz-executor.5 48480 59233 97763 0 3 0x82 wait syz-executor.5 73037 415529 87541 32767 2 0x10 syz-executor.6 71576 112886 28064 32767 3 0x90 nanoslp syz-executor.7 28064 449939 97763 0 3 0x82 wait syz-executor.7 87541 318168 97763 0 3 0x82 wait syz-executor.6 40625 412114 62095 32767 3 0x90 nanoslp syz-executor.2 32920 78069 97763 0 3 0x82 wait syz-executor.4 2322 34596 85217 32767 3 0x90 nanoslp syz-executor.3 85217 299364 97763 0 3 0x82 wait syz-executor.3 62095 196231 97763 0 3 0x82 wait syz-executor.2 77266 521833 35592 32767 3 0x90 nanoslp syz-executor.0 35592 155495 97763 0 3 0x82 wait syz-executor.0 97763 342081 21263 0 3 0x82 kqread syz-fuzzer 97763 355512 21263 0 3 0x4000082 nanoslp syz-fuzzer 97763 184742 21263 0 3 0x4000082 thrsleep syz-fuzzer 97763 178741 21263 0 3 0x4000082 thrsleep syz-fuzzer 97763 242333 21263 0 3 0x4000082 thrsleep syz-fuzzer 97763 331200 21263 0 3 0x4000082 thrsleep syz-fuzzer 97763 101354 21263 0 3 0x4000082 thrsleep syz-fuzzer 97763 469880 21263 0 3 0x4000082 thrsleep syz-fuzzer 97763 309298 21263 0 3 0x4000082 thrsleep syz-fuzzer 21263 462446 16895 0 3 0x10008a sigsusp ksh 16895 446666 4664 0 3 0x9a kqread sshd 18843 487758 1 0 3 0x100083 ttyin getty 4664 419293 1 0 3 0x88 kqread sshd 49358 163766 15796 73 3 0x1100090 kqread syslogd 15796 118783 1 0 3 0x100082 netio syslogd 94281 160036 1 0 3 0x100080 kqread resolvd 25146 166902 63011 77 3 0x100092 kqread dhcpleased 59483 149006 63011 77 3 0x100092 kqread dhcpleased 63011 338277 1 0 3 0x80 kqread dhcpleased 14726 454583 0 0 3 0x14200 bored smr 14247 154086 0 0 2 0x14200 zerothread 69736 278093 0 0 3 0x14200 aiodoned aiodoned 60559 375313 0 0 3 0x14200 syncer update 23560 415802 0 0 3 0x14200 cleaner cleaner 1077 131122 0 0 3 0x14200 reaper reaper 75551 480894 0 0 3 0x14200 pgdaemon pagedaemon 23428 476776 0 0 3 0x14200 bored viomb 42657 48793 0 0 3 0x40014200 acpi0 acpi0 20090 227338 0 0 3 0x40014200 idle1 73869 208821 0 0 3 0x14200 bored softnet 64456 30970 0 0 3 0x14200 bored systqmp 71390 265763 0 0 3 0x14200 bored systq 44822 260612 0 0 3 0x40014200 bored softclock 75435 164773 0 0 3 0x40014200 idle0 1 429424 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 11064 (syz-executor.1) thread 0xffff8000fffefa48 (44004) shared rwlock vmmaplk r = 0 (0xfffffd80696aaa40) #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 10190 6409K 6419K 78643K 11287 0 pcb 13 10K 12K 78643K 15 0 rtable 244 7K 7K 78643K 510 0 ifaddr 81 16K 16K 78643K 96 0 sysctl 2 0K 0K 78643K 2 0 counters 56 35K 35K 78643K 60 0 ioctlops 0 0K 2K 78643K 39 0 iov 0 0K 12K 78643K 160 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 5 0 vnodes 1270 79K 79K 78643K 1513 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 5K 78643K 8 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 1K 78643K 327 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 24 89K 113K 78643K 1398 0 sigio 3 0K 0K 78643K 755 0 proc 56 74K 99K 78643K 602 0 subproc 104 6K 6K 78643K 130 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 89 0 in_multi 99 6K 6K 78643K 134 0 ether_multi 1 0K 0K 78643K 11 0 mrt 2 0K 0K 78643K 2 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 157 705K 705K 78643K 157 0 exec 0 0K 2K 78643K 756 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 356 88K 103K 78643K 19241 0 UVM aobj 67 3K 3K 78643K 67 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 27 0 NDP 11 0K 2K 78643K 33 0 temp 125 4704K 4767K 78643K 7204 0 kqueue 12 18K 26K 78643K 119 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 68 0 65 1 0 1 1 0 8 0 rtentry 112 137 0 24 4 0 4 4 0 8 0 unpcb 136 1269 0 1253 9 6 3 4 0 8 2 syncache 296 20 0 20 5 5 0 1 0 8 0 tcpqe 32 25 0 25 3 3 0 1 0 8 0 tcpcb 736 1186 0 1173 41 32 9 16 0 8 6 arp 120 23 0 4 1 0 1 1 0 8 0 inpcb 304 1537 0 1520 28 21 7 9 0 8 5 nd6 48 33 0 7 1 0 1 1 0 8 0 kcovpl 48 10 0 2 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 545 0 90 29 0 29 29 0 8 0 art_table 32 546 0 90 4 0 4 4 0 8 0 art_node 16 136 0 33 1 0 1 1 0 8 0 sysvmsgpl 40 38 0 11 1 0 1 1 0 8 0 semupl 112 1 0 1 1 1 0 1 0 8 0 semapl 112 290 0 280 1 0 1 1 0 8 0 shmpl 112 64 0 0 2 0 2 2 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 3095 0 1665 90 0 90 90 0 8 0 ffsino 272 3095 0 1665 96 0 96 96 0 8 0 nchpl 144 5168 0 3543 62 0 62 62 0 8 0 uvmvnodes 80 3234 0 0 66 0 66 66 0 8 0 vnodes 224 3234 0 0 191 0 191 191 0 8 0 namei 1024 16947 0 16947 4 3 1 2 0 8 1 percpumem 16 42 0 2 1 0 1 1 0 8 0 scxspl 216 18422 0 18422 11 8 3 8 0 8 3 plimitpl 152 169 0 145 1 0 1 1 0 8 0 sigapl 424 1671 0 1620 7 1 6 7 0 8 0 futexpl 64 11556 0 11551 1 0 1 1 0 8 0 knotepl 120 180 0 0 6 0 6 6 0 8 0 kqueuepl 216 665 0 657 14 13 1 7 0 8 0 pipepl 336 287 0 259 6 3 3 6 0 8 0 fdescpl 496 1656 0 1621 7 2 5 6 0 8 0 filepl 152 9854 0 9612 31 17 14 17 0 8 4 lockfpl 104 318 0 316 1 0 1 1 0 8 0 lockfspl 48 61 0 59 1 0 1 1 0 8 0 sessionpl 144 25 0 9 1 0 1 1 0 8 0 pgrppl 48 105 0 89 1 0 1 1 0 8 0 ucredpl 96 1480 0 1462 1 0 1 1 0 8 0 zombiepl 144 1621 0 1620 1 0 1 1 0 8 0 processpl 1064 1671 0 1620 5 1 4 4 0 8 0 procpl 672 4162 0 4094 10 3 7 7 0 8 1 sosppl 168 19 0 19 2 2 0 1 0 8 0 sockpl 480 2877 0 2846 56 44 12 20 0 8 7 mcl64k 65536 16 0 0 2 0 2 2 0 8 0 mcl16k 16384 7 0 0 1 0 1 1 0 8 0 mcl12k 12288 13 0 0 2 0 2 2 0 8 0 mcl9k 9216 7 0 0 1 0 1 1 0 8 0 mcl8k 8192 13 0 0 2 0 2 2 0 8 0 mcl4k 4096 11 0 0 2 0 2 2 0 8 0 mcl2k2 2112 5 0 0 1 0 1 1 0 8 0 mcl2k 2048 156 0 0 18 1 17 18 0 8 0 mtagpl 96 3 0 0 1 0 1 1 0 8 0 mbufpl 256 421 0 0 24 0 24 24 0 8 0 bufpl 288 5847 0 147 408 0 408 408 0 8 0 anonpl 24 430131 0 415874 126 31 95 110 0 186 0 amapchunkpl 152 54033 0 53211 63 28 35 45 0 158 2 amappl16 200 3538 0 3156 35 13 22 33 0 8 1 amappl15 192 261 0 254 1 0 1 1 0 8 0 amappl14 184 21 0 18 1 0 1 1 0 8 0 amappl13 176 404 0 399 1 0 1 1 0 8 0 amappl12 168 293 0 285 1 0 1 1 0 8 0 amappl11 160 215 0 202 1 0 1 1 0 8 0 amappl10 152 205 0 201 1 0 1 1 0 8 0 amappl9 144 629 0 623 1 0 1 1 0 8 0 amappl8 136 640 0 571 3 0 3 3 0 8 0 amappl7 128 125 0 113 1 0 1 1 0 8 0 amappl6 120 365 0 345 2 1 1 2 0 8 0 amappl5 112 1537 0 1515 1 0 1 1 0 8 0 amappl4 104 1181 0 1152 2 0 2 2 0 8 0 amappl3 96 571 0 555 1 0 1 1 0 8 0 amappl2 88 934 0 889 3 1 2 3 0 8 0 amappl1 80 32588 0 31945 18 3 15 18 0 8 0 amappl 88 18722 0 18451 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 66 0 0 2 0 2 2 0 8 0 uaddrrnd 24 1656 0 1621 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 1656 0 1621 1 0 1 1 0 8 0 vmmpekpl 168 16542 0 16484 3 0 3 3 0 8 0 vmmpepl 168 153170 0 150519 140 16 124 130 0 357 3 vmsppl 368 1655 0 1621 4 0 4 4 0 8 0 rwobjpl 56 40823 0 36172 66 0 66 66 0 8 0 pdppl 4096 3319 0 3242 130 49 81 89 0 8 4 pvpl 32 913515 0 893989 250 80 170 250 0 265 5 pmappl 248 1655 0 1621 4 1 3 3 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 864 0 90 23 0 23 23 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(fffffd80693eec00,9,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(fffffd80693eec00,9,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_write(fffffd80693eebf0) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:128 fill_file(ffff800000c43000,fffffd80673fa318,fffffd80693eeba8,0,0,ffff8000fffeb200,57c774a2a75eef53,2,0) at fill_file+0xad2 sys/kern/kern_sysctl.c:1304 sysctl_file(ffff80002120e3f8,4,20000080,ffff80002120e428,ffff8000fffefa48) at sysctl_file+0x62d sys/kern/kern_sysctl.c:1457 kern_sysctl(ffff80002120e3f4,5,20000080,ffff80002120e428,0,0,846b93db47503f05) at kern_sysctl+0xfd sys/kern/kern_sysctl.c:449 sys_sysctl(ffff8000fffefa48,ffff80002120e498,ffff80002120e4f0) at sys_sysctl+0x209 sys/kern/kern_sysctl.c:249 syscall(ffff80002120e560) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002120e560) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x92e7de533e0, 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(ffff800022c5e3d0) at syscall+0x3ef mi_syscall sys/sys/syscall_mi.h:93 [inline] syscall(ffff800022c5e3d0) at syscall+0x3ef sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x1e1cf1e19d0, count: -6