witness: lock order reversal: 1st 0xffffffff8290fe50 netlock (netlock) 2nd 0xfffffd806502fbb0 vmmaplk (&map->lock) lock order "&map->lock"(rwlock) -> "netlock"(rwlock) first seen at: #0 rw_enter_write+0x5b sys/kern/kern_rwlock.c:128 #1 udp_sysctl+0x8a sys/netinet/udp_usrreq.c:1269 #2 sys_sysctl+0x209 sys/kern/kern_sysctl.c:249 #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 lock order "netlock"(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 ifioctl_get+0x2dd #9 soo_ioctl+0x26c #10 sys_ioctl+0x4a2 #11 syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] #11 syscall+0x489 sys/arch/amd64/amd64/trap.c:585 #12 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(fffffd806502fbb0,1,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(fffffd806502fbb0,1,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_read(fffffd806502fba0) at rw_enter_read+0x66 sys/kern/kern_rwlock.c:112 uvmfault_lookup(ffff800024677990,0) at uvmfault_lookup+0xd9 sys/uvm/uvm_fault.c:1758 uvm_fault_check(ffff800024677990,ffff8000246779c8,ffff8000246779f0) at uvm_fault_check+0x3a sys/uvm/uvm_fault.c:674 uvm_fault(fffffd806502fb98,20000000,0,2) at uvm_fault+0x102 sys/uvm/uvm_fault.c:602 kpageflttrap(ffff800024677b20,20000300) at kpageflttrap+0x209 kerntrap(ffff800024677b20) at kerntrap+0xef sys/arch/amd64/amd64/trap.c:318 alltraps_kern_meltdown() at alltraps_kern_meltdown+0x7b copyout() at copyout+0x53 ifioctl_get(c0106924,ffff800024677dd0) at ifioctl_get+0x2dd soo_ioctl(fffffd8069121be0,c0106924,ffff800024677dd0,ffff8000fffeefc8) at soo_ioctl+0x26c sys_ioctl(ffff8000fffeefc8,ffff800024677ee8,ffff800024677f40) at sys_ioctl+0x4a2 syscall(ffff800024677fb0) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff800024677fb0) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x1c196668ee0, count: -15 ddb{0}> show registers rdi 0x3 rsi 0xffffffff8294abb0 __sancov_gen_cov_switch_values.134 rbp 0xffff800024677680 rbx 0x3 rdx 0 rcx 0 rax 0xffff8000fffeefc8 r8 0xffff8000246775f0 r9 0x8080808080808080 r10 0x95ef6f10e3068c8d r11 0x41a438dd820d9fa3 r12 0xffffffff82ab0900 w_lodata+0x52f90 r13 0 r14 0xffffffff82aac4f0 w_lodata+0x4eb80 r15 0xfffffd8002f62d80 rip 0xffffffff8138d658 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800024677670 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.6) pid=451662 stat=onproc flags process=10 proc=4000000 pri=32, usrpri=50, nice=20 forw=0xffffffffffffffff, list=0xffff8000ffff5500,0xffff8000fffec560 process=0xffff8000fffe90c0 user=0xffff800024673000, vmspace=0xfffffd806502fb98 estcpu=0, cpticks=1, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 27344 242640 14526 32767 3 0x90 nanoslp syz-executor.2 27344 99795 14526 32767 2 0x4000010 syz-executor.2 27344 196979 14526 32767 3 0x4000090 fsleep syz-executor.2 84285 29308 10942 32767 2 0x10 syz-executor.1 84285 392731 10942 32767 2 0x4000010 syz-executor.1 75486 20663 90490 32767 2 0x10 syz-executor.5 75486 332538 90490 32767 3 0x4000090 fsleep syz-executor.5 81419 405337 68192 32767 2 0x10 syz-executor.6 *81419 451662 68192 32767 7 0x4000010 syz-executor.6 6293 487548 76279 32767 2 0x10 syz-executor.7 6293 425602 76279 32767 3 0x4000090 kqread syz-executor.7 85722 410960 26460 32767 2 0x10 syz-executor.3 76279 195295 79146 32767 3 0x90 nanoslp syz-executor.7 79146 450611 99162 0 3 0x82 wait syz-executor.7 68192 21417 42223 32767 3 0x90 nanoslp syz-executor.6 14526 481547 95780 32767 3 0x90 nanoslp syz-executor.2 8361 56266 58023 32767 3 0x90 nanoslp syz-executor.4 42223 384655 99162 0 3 0x82 wait syz-executor.6 90490 64395 18694 32767 3 0x90 nanoslp syz-executor.5 95780 393121 99162 0 3 0x82 wait syz-executor.2 58023 465930 99162 0 3 0x82 wait syz-executor.4 18694 101146 99162 0 3 0x82 wait syz-executor.5 10942 3507 91079 32767 3 0x90 nanoslp syz-executor.1 26460 105101 99162 0 3 0x82 wait syz-executor.3 51871 223262 52196 32767 3 0x90 nanoslp syz-executor.0 91079 459546 99162 0 3 0x82 wait syz-executor.1 52196 35121 99162 0 3 0x82 wait syz-executor.0 99162 148815 85048 0 3 0x82 thrsleep syz-fuzzer 99162 27916 85048 0 3 0x4000082 nanoslp syz-fuzzer 99162 14986 85048 0 3 0x4000082 thrsleep syz-fuzzer 99162 464366 85048 0 3 0x4000082 nanoslp syz-fuzzer 99162 467179 85048 0 2 0x4000002 syz-fuzzer 99162 372898 85048 0 3 0x4000082 thrsleep syz-fuzzer 99162 445119 85048 0 3 0x4000082 thrsleep syz-fuzzer 99162 135978 85048 0 3 0x4000082 thrsleep syz-fuzzer 85048 135648 6052 0 3 0x10008a sigsusp ksh 6052 47793 63958 0 3 0x9a kqread sshd 59137 153873 1 0 3 0x100083 ttyin getty 63958 34718 1 0 3 0x88 kqread sshd 17246 485540 52481 73 3 0x1100090 kqread syslogd 52481 104525 1 0 3 0x100082 netio syslogd 21991 258851 1 0 3 0x100080 kqread resolvd 27659 377752 86390 77 3 0x100092 kqread dhcpleased 15976 484437 86390 77 3 0x100092 kqread dhcpleased 86390 427961 1 0 3 0x80 kqread dhcpleased 85126 432048 0 0 3 0x14200 bored smr 83780 143603 0 0 2 0x14200 zerothread 43402 159420 0 0 3 0x14200 aiodoned aiodoned 59621 486206 0 0 3 0x14200 syncer update 16987 377098 0 0 3 0x14200 cleaner cleaner 91125 406876 0 0 7 0x14200 reaper 74048 296844 0 0 3 0x14200 pgdaemon pagedaemon 23917 158716 0 0 3 0x14200 bored viomb 72780 34441 0 0 3 0x40014200 acpi0 acpi0 61403 149179 0 0 3 0x40014200 idle1 26816 299872 0 0 3 0x14200 bored softnet 11821 259991 0 0 3 0x14200 bored systqmp 86054 64157 0 0 3 0x14200 bored systq 64410 484607 0 0 3 0x40014200 bored softclock 5748 422483 0 0 3 0x40014200 idle0 1 298804 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 81419 (syz-executor.6) thread 0xffff8000fffeefc8 (451662) shared rwlock netlock r = 0 (0xffffffff8290fe50) #0 witness_lock+0x44d #1 ifioctl_get+0x2d5 sys/net/if.c:2319 #2 soo_ioctl+0x26c #3 sys_ioctl+0x4a2 #4 syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] #4 syscall+0x489 sys/arch/amd64/amd64/trap.c:585 #5 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 0 (0xffffffff829de988) #0 witness_lock+0x44d #1 soo_ioctl+0x25a sys/kern/sys_socket.c:136 #2 sys_ioctl+0x4a2 #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 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 10169 6406K 6419K 78643K 11259 0 pcb 13 8K 8K 78643K 13 0 rtable 238 6K 7K 78643K 348 0 ifaddr 81 16K 16K 78643K 82 0 counters 56 35K 35K 78643K 56 0 ioctlops 0 0K 2K 78643K 36 0 iov 0 0K 0K 78643K 7 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 5 0 vnodes 1270 79K 79K 78643K 1285 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 9K 78643K 7 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 121K 78643K 176 0 proc 56 74K 111K 78643K 454 0 subproc 104 6K 6K 78643K 104 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 in_multi 99 6K 6K 78643K 99 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 37 175K 175K 78643K 37 0 exec 0 0K 2K 78643K 609 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 293 78K 79K 78643K 3479 0 UVM aobj 6 2K 2K 78643K 6 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 NDP 19 1K 2K 78643K 27 0 temp 86 4697K 4761K 78643K 4205 0 kqueue 13 20K 20K 78643K 24 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 33 0 30 1 0 1 1 0 8 0 rtentry 112 111 0 1 4 0 4 4 0 8 0 unpcb 136 253 0 238 5 0 5 5 0 8 4 syncache 296 4 0 4 1 1 0 1 0 8 0 tcpqe 32 5 0 5 1 0 1 1 0 8 1 tcpcb 736 8 0 4 1 0 1 1 0 8 0 arp 120 18 0 0 1 0 1 1 0 8 0 inpcb 304 64 0 54 1 0 1 1 0 8 0 nd6 48 24 0 0 1 0 1 1 0 8 0 kcovpl 48 8 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 452 0 0 29 0 29 29 0 8 0 art_table 32 453 0 0 4 0 4 4 0 8 0 art_node 16 110 0 10 1 0 1 1 0 8 0 shmpl 112 3 0 0 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 1506 0 78 90 0 90 90 0 8 0 ffsino 272 1506 0 78 96 0 96 96 0 8 0 nchpl 144 1807 0 144 62 0 62 62 0 8 0 uvmvnodes 80 1619 0 0 34 0 34 34 0 8 0 vnodes 224 1619 0 0 96 0 96 96 0 8 0 namei 1024 6127 0 6127 2 0 2 2 0 8 2 percpumem 16 40 0 0 1 0 1 1 0 8 0 scxspl 216 5493 0 5493 2 1 1 2 0 8 1 plimitpl 152 30 0 8 1 0 1 1 0 8 0 sigapl 424 449 0 399 7 0 7 7 0 8 1 futexpl 64 430 0 428 1 0 1 1 0 8 0 knotepl 120 108 0 0 4 0 4 4 0 8 0 kqueuepl 216 20 0 11 1 0 1 1 0 8 0 pipepl 336 128 0 100 3 0 3 3 0 8 0 fdescpl 496 435 0 401 7 1 6 6 0 8 1 filepl 152 1945 0 1706 16 1 15 15 0 8 5 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 23 0 7 1 0 1 1 0 8 0 pgrppl 48 23 0 7 1 0 1 1 0 8 0 ucredpl 96 103 0 85 1 0 1 1 0 8 0 zombiepl 144 401 0 399 1 0 1 1 0 8 0 processpl 1064 449 0 399 5 1 4 4 0 8 0 procpl 672 552 0 489 7 0 7 7 0 8 0 sockpl 480 350 0 322 20 0 20 20 0 8 16 mcl64k 65536 2 0 0 1 0 1 1 0 8 0 mcl16k 16384 3 0 0 1 0 1 1 0 8 0 mcl12k 12288 2 0 0 1 0 1 1 0 8 0 mcl8k 8192 6 0 0 1 0 1 1 0 8 0 mcl4k 4096 5 0 0 1 0 1 1 0 8 0 mcl2k 2048 148 0 0 18 0 18 18 0 8 0 mtagpl 96 2 0 0 1 0 1 1 0 8 0 mbufpl 256 318 0 0 20 0 20 20 0 8 0 bufpl 288 3611 0 139 248 0 248 248 0 8 0 anonpl 24 72426 0 60244 77 0 77 77 0 186 0 amapchunkpl 152 7581 0 6855 32 1 31 31 0 158 0 amappl16 200 595 0 277 18 1 17 17 0 8 0 amappl15 192 115 0 106 1 0 1 1 0 8 0 amappl14 184 28 0 24 1 0 1 1 0 8 0 amappl13 176 86 0 83 1 0 1 1 0 8 0 amappl12 168 26 0 22 1 0 1 1 0 8 0 amappl11 160 61 0 43 1 0 1 1 0 8 0 amappl10 152 40 0 34 1 0 1 1 0 8 0 amappl9 144 464 0 462 1 0 1 1 0 8 0 amappl8 136 539 0 499 2 0 2 2 0 8 0 amappl7 128 114 0 104 1 0 1 1 0 8 0 amappl6 120 202 0 182 2 0 2 2 0 8 1 amappl5 112 233 0 213 1 0 1 1 0 8 0 amappl4 104 822 0 786 2 0 2 2 0 8 0 amappl3 96 177 0 161 1 0 1 1 0 8 0 amappl2 88 521 0 475 3 0 3 3 0 8 1 amappl1 80 10799 0 10183 18 2 16 18 0 8 2 amappl 88 3074 0 2835 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 5 0 0 1 0 1 1 0 8 0 uaddrrnd 24 435 0 401 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 435 0 401 1 0 1 1 0 8 0 vmmpekpl 168 8118 0 8069 3 0 3 3 0 8 0 vmmpepl 168 42739 0 40280 116 0 116 116 0 357 1 vmsppl 368 434 0 400 4 0 4 4 0 8 0 rwobjpl 56 12844 0 10001 42 0 42 42 0 8 0 pdppl 4096 877 0 800 109 16 93 93 0 8 16 pvpl 32 258895 0 241795 245 1 244 244 0 265 99 pmappl 248 434 0 400 4 1 3 3 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 631 0 18 18 0 18 18 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(fffffd806502fbb0,1,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(fffffd806502fbb0,1,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_read(fffffd806502fba0) at rw_enter_read+0x66 sys/kern/kern_rwlock.c:112 uvmfault_lookup(ffff800024677990,0) at uvmfault_lookup+0xd9 sys/uvm/uvm_fault.c:1758 uvm_fault_check(ffff800024677990,ffff8000246779c8,ffff8000246779f0) at uvm_fault_check+0x3a sys/uvm/uvm_fault.c:674 uvm_fault(fffffd806502fb98,20000000,0,2) at uvm_fault+0x102 sys/uvm/uvm_fault.c:602 kpageflttrap(ffff800024677b20,20000300) at kpageflttrap+0x209 kerntrap(ffff800024677b20) at kerntrap+0xef sys/arch/amd64/amd64/trap.c:318 alltraps_kern_meltdown() at alltraps_kern_meltdown+0x7b copyout() at copyout+0x53 ifioctl_get(c0106924,ffff800024677dd0) at ifioctl_get+0x2dd soo_ioctl(fffffd8069121be0,c0106924,ffff800024677dd0,ffff8000fffeefc8) at soo_ioctl+0x26c sys_ioctl(ffff8000fffeefc8,ffff800024677ee8,ffff800024677f40) at sys_ioctl+0x4a2 syscall(ffff800024677fb0) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff800024677fb0) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x1c196668ee0, count: -15 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+0x129 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff829de780) at __mp_lock+0x129 sys/kern/kern_lock.c:147 uvm_unmap_detach(ffff800021135d50,1) at uvm_unmap_detach+0x113 sys/uvm/uvm_map.c:1615 uvm_map_teardown(fffffd806502f468) at uvm_map_teardown+0x262 sys/uvm/uvm_map.c:2789 uvmspace_free(fffffd806502f468) at uvmspace_free+0xa6 sys/uvm/uvm_map.c:3685 reaper(ffff8000210f97a0) at reaper+0x18b sys/kern/kern_exit.c:457 end trace frame: 0x0, count: -8