witness: lock order reversal: 1st 0xffffffff8290fe50 netlock (netlock) 2nd 0xfffffd80772d4758 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{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(fffffd80772d4758,1,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(fffffd80772d4758,1,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_read(fffffd80772d4748) at rw_enter_read+0x66 sys/kern/kern_rwlock.c:112 uvmfault_lookup(ffff8000280f59e0,0) at uvmfault_lookup+0xd9 sys/uvm/uvm_fault.c:1758 uvm_fault_check(ffff8000280f59e0,ffff8000280f5a18,ffff8000280f5a40) at uvm_fault_check+0x3a sys/uvm/uvm_fault.c:674 uvm_fault(fffffd80772d4740,20000000,0,2) at uvm_fault+0x102 sys/uvm/uvm_fault.c:602 kpageflttrap(ffff8000280f5b70,20000300) at kpageflttrap+0x209 kerntrap(ffff8000280f5b70) 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,ffff8000280f5e20) at ifioctl_get+0x2dd soo_ioctl(fffffd80761b7850,c0106924,ffff8000280f5e20,ffff800025eaefd0) at soo_ioctl+0x26c sys_ioctl(ffff800025eaefd0,ffff8000280f5f38,ffff8000280f5f90) at sys_ioctl+0x4a2 syscall(ffff8000280f6000) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000280f6000) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xfa087c46590, count: -15 ddb{1}> show registers rdi 0x3 rsi 0xffffffff8294abb0 __sancov_gen_cov_switch_values.134 rbp 0xffff8000280f56d0 rbx 0x3 rdx 0 rcx 0 rax 0xffff800025eaefd0 r8 0xffff8000280f5640 r9 0x8080808080808080 r10 0xd2848599eb16d0db r11 0x58d487549f5bfa9d r12 0xffffffff82ab06f0 w_lodata+0x52d80 r13 0 r14 0xffffffff82aa5850 w_lodata+0x47ee0 r15 0xfffffd8002f62d80 rip 0xffffffff8138d658 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff8000280f56c0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.0) pid=341117 stat=onproc flags process=10 proc=4000000 pri=80, usrpri=80, nice=20 forw=0xffffffffffffffff, list=0xffff800025eafcf0,0xffff800025eae020 process=0xffff8000ffff14e0 user=0xffff8000280f1000, vmspace=0xfffffd80772d4740 estcpu=36, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 14350 185779 86271 32767 2 0x10 syz-executor.4 29418 361868 14984 32767 2 0x10 syz-executor.7 99261 506425 67562 32767 2 0x10 syz-executor.1 58334 57352 13153 32767 3 0x90 nanoslp syz-executor.3 58334 449031 13153 32767 3 0x4000090 fsleep syz-executor.3 58334 230226 13153 32767 3 0x4000090 fsleep syz-executor.3 58334 384558 13153 32767 3 0x4000090 fsleep syz-executor.3 88139 62435 85068 32767 3 0x90 nanoslp syz-executor.0 88139 396317 85068 32767 3 0x4000090 fsleep syz-executor.0 *88139 341117 85068 32767 7 0x4000010 syz-executor.0 52489 92694 81642 32767 2 0x10 syz-executor.5 81642 36587 10944 32767 3 0x90 nanoslp syz-executor.5 10944 141814 69087 0 3 0x82 wait syz-executor.5 67562 448523 62279 32767 3 0x90 nanoslp syz-executor.1 62279 71473 69087 0 3 0x82 wait syz-executor.1 12389 223634 0 0 3 0x14200 bored sosplice 14984 252022 69356 32767 3 0x90 nanoslp syz-executor.7 69356 167442 69087 0 3 0x82 wait syz-executor.7 86271 400665 28678 32767 3 0x90 nanoslp syz-executor.4 95950 353018 75699 32767 3 0x90 piperd syz-executor.6 75699 117470 69087 0 3 0x82 wait syz-executor.6 13055 246814 28490 32767 3 0x90 nanoslp syz-executor.2 13153 392753 11477 32767 3 0x90 nanoslp syz-executor.3 28678 195272 69087 0 3 0x82 wait syz-executor.4 11477 31246 69087 0 3 0x82 wait syz-executor.3 28490 491650 69087 0 3 0x82 wait syz-executor.2 85068 159238 64919 32767 3 0x90 nanoslp syz-executor.0 64919 352670 69087 0 3 0x82 wait syz-executor.0 69087 450638 7478 0 3 0x82 nanoslp syz-fuzzer 69087 99501 7478 0 3 0x4000082 nanoslp syz-fuzzer 69087 56181 7478 0 3 0x4000082 thrsleep syz-fuzzer 69087 258347 7478 0 3 0x4000082 thrsleep syz-fuzzer 69087 518606 7478 0 3 0x4000082 thrsleep syz-fuzzer 69087 327738 7478 0 3 0x4000082 kqread syz-fuzzer 69087 22101 7478 0 3 0x4000082 thrsleep syz-fuzzer 69087 415930 7478 0 3 0x4000082 thrsleep syz-fuzzer 69087 73365 7478 0 3 0x4000082 thrsleep syz-fuzzer 7478 490953 2417 0 3 0x10008a sigsusp ksh 2417 421850 98190 0 3 0x9a kqread sshd 56085 416715 1 0 3 0x100083 ttyin getty 98190 73146 1 0 3 0x88 kqread sshd 79833 268270 99443 73 3 0x1100090 kqread syslogd 99443 280488 1 0 3 0x100082 netio syslogd 15201 362317 1 0 3 0x100080 kqread resolvd 49334 3609 78879 77 3 0x100092 kqread dhcpleased 34076 506877 78879 77 3 0x100092 kqread dhcpleased 78879 221799 1 0 3 0x80 kqread dhcpleased 6264 293116 0 0 3 0x14200 bored smr 88344 414163 0 0 2 0x14200 zerothread 17778 4472 0 0 3 0x14200 aiodoned aiodoned 51976 91179 0 0 3 0x14200 syncer update 39225 374400 0 0 3 0x14200 cleaner cleaner 70839 186318 0 0 7 0x14200 reaper 5601 328440 0 0 3 0x14200 pgdaemon pagedaemon 99387 18820 0 0 3 0x14200 bored viomb 36543 460155 0 0 3 0x40014200 acpi0 acpi0 33479 11824 0 0 3 0x40014200 idle1 21338 190484 0 0 3 0x14200 bored softnet 87757 223793 0 0 3 0x14200 bored systqmp 75084 129542 0 0 3 0x14200 bored systq 87087 450936 0 0 3 0x40014200 bored softclock 17877 445635 0 0 3 0x40014200 idle0 1 58398 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 88139 (syz-executor.0) thread 0xffff800025eaefd0 (341117) 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{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 10203 6411K 6419K 78643K 11307 0 pcb 13 12K 14K 78643K 17 0 rtable 256 7K 7K 78643K 564 0 ifaddr 81 16K 16K 78643K 110 0 sysctl 1 1K 1K 78643K 1 0 counters 56 35K 35K 78643K 64 0 ioctlops 0 0K 2K 78643K 44 0 iov 0 0K 20K 78643K 429 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 4 0 vnodes 1270 79K 79K 78643K 1892 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 9K 78643K 28 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 0K 78643K 373 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 24 89K 113K 78643K 2626 0 sigio 0 0K 0K 78643K 144 0 proc 56 74K 111K 78643K 790 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 1313 0 in_multi 99 6K 6K 78643K 522 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 235 1049K 1049K 78643K 235 0 exec 0 0K 2K 78643K 1091 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 335 89K 99K 78643K 34791 0 UVM aobj 131 4K 4K 78643K 131 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 59 0 NDP 11 0K 2K 78643K 39 0 temp 125 4707K 4771K 78643K 10208 0 kqueue 12 18K 26K 78643K 458 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 300 0 297 6 5 1 3 0 8 0 rtentry 112 167 0 48 4 0 4 4 0 8 0 unpcb 136 6079 0 6066 31 24 7 13 0 8 6 syncache 296 37 0 37 4 3 1 1 0 8 1 tcpqe 32 12 0 12 2 2 0 1 0 8 0 tcpcb 736 869 0 848 20 18 2 12 0 8 0 arp 120 27 0 8 1 0 1 1 0 8 0 ipq 40 5 0 5 1 1 0 1 0 8 0 ipqe 40 10 0 10 1 1 0 1 0 8 0 inpcb 304 3384 0 3363 36 26 10 11 0 8 7 rttmr 72 3 0 2 1 0 1 1 0 8 0 ip6q 72 6 0 6 1 1 0 1 0 8 0 ip6af 40 11 0 11 1 1 0 1 0 8 0 nd6 48 46 0 15 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 725 0 189 34 0 34 34 0 8 0 art_table 32 726 0 189 5 0 5 5 0 8 0 art_node 16 166 0 57 1 0 1 1 0 8 0 sysvmsgpl 40 20 0 4 1 0 1 1 0 8 0 semupl 112 1 0 1 1 1 0 1 0 8 0 semapl 112 370 0 360 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 4791 0 3358 90 0 90 90 0 8 0 ffsino 272 4791 0 3358 96 0 96 96 0 8 0 nchpl 144 8278 0 6654 62 0 62 62 0 8 0 uvmvnodes 80 4956 0 0 102 0 102 102 0 8 0 vnodes 224 4956 0 0 292 0 292 292 0 8 0 namei 1024 26581 0 26581 2 1 1 2 0 8 1 percpumem 16 44 0 4 1 0 1 1 0 8 0 scxspl 216 22293 0 22293 11 10 1 8 0 8 1 plimitpl 152 328 0 305 1 0 1 1 0 8 0 sigapl 424 2903 0 2852 7 1 6 7 0 8 0 futexpl 64 22216 0 22212 1 0 1 1 0 8 0 knotepl 120 550 0 0 17 1 16 17 0 8 0 kqueuepl 216 1484 0 1476 15 10 5 5 0 8 4 pipepl 336 635 0 607 28 22 6 9 0 8 3 fdescpl 496 2888 0 2853 7 2 5 6 0 8 0 filepl 152 22631 0 22391 42 25 17 23 0 8 6 lockfpl 104 445 0 443 2 1 1 2 0 8 0 lockfspl 48 85 0 83 1 0 1 1 0 8 0 sessionpl 144 27 0 11 1 0 1 1 0 8 0 pgrppl 48 30 0 14 1 0 1 1 0 8 0 ucredpl 96 3004 0 2986 1 0 1 1 0 8 0 zombiepl 144 2853 0 2852 1 0 1 1 0 8 0 processpl 1064 2903 0 2852 5 1 4 4 0 8 0 procpl 672 7676 0 7612 8 1 7 7 0 8 1 sosppl 168 60 0 60 4 4 0 1 0 8 0 sockpl 480 9814 0 9778 249 232 17 48 0 8 10 mcl64k 65536 16 0 0 2 0 2 2 0 8 0 mcl16k 16384 8 0 0 1 0 1 1 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 17 0 0 3 0 3 3 0 8 0 mcl4k 4096 18 0 0 3 0 3 3 0 8 0 mcl2k2 2112 3 0 0 1 0 1 1 0 8 0 mcl2k 2048 164 0 0 19 0 19 19 0 8 0 mtagpl 96 3 0 0 1 0 1 1 0 8 0 mbufpl 256 543 0 0 29 0 29 29 0 8 0 bufpl 288 6816 0 481 453 0 453 453 0 8 0 anonpl 24 760288 0 746964 129 39 90 108 0 186 0 amapchunkpl 152 84156 0 83410 55 20 35 43 0 158 3 amappl16 200 6430 0 6071 36 16 20 28 0 8 0 amappl15 192 1039 0 1029 1 0 1 1 0 8 0 amappl14 184 323 0 321 2 1 1 1 0 8 0 amappl13 176 406 0 403 1 0 1 1 0 8 0 amappl12 168 367 0 363 2 1 1 1 0 8 0 amappl11 160 549 0 534 1 0 1 1 0 8 0 amappl10 152 43 0 40 1 0 1 1 0 8 0 amappl9 144 862 0 856 1 0 1 1 0 8 0 amappl8 136 720 0 645 3 0 3 3 0 8 0 amappl7 128 135 0 123 1 0 1 1 0 8 0 amappl6 120 584 0 559 2 1 1 2 0 8 0 amappl5 112 1669 0 1653 1 0 1 1 0 8 0 amappl4 104 2234 0 2190 2 0 2 2 0 8 0 amappl3 96 1053 0 1038 1 0 1 1 0 8 0 amappl2 88 1045 0 999 3 1 2 3 0 8 0 amappl1 80 55520 0 54903 22 7 15 18 0 8 0 amappl 88 34188 0 33940 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 2888 0 2853 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 2888 0 2853 1 0 1 1 0 8 0 vmmpekpl 168 25126 0 25064 4 0 4 4 0 8 0 vmmpepl 168 264728 0 262149 133 9 124 124 0 357 7 vmsppl 368 2887 0 2852 4 0 4 4 0 8 0 rwobjpl 56 69502 0 63118 91 0 91 91 0 8 0 pdppl 4096 5783 0 5704 159 78 81 89 0 8 2 pvpl 32 1357271 0 1338854 262 95 167 244 0 265 3 pmappl 248 2887 0 2852 4 1 3 3 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 950 0 121 24 0 24 24 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 intr_handler(ffff800021134d00,ffff800000077500) at intr_handler+0x5e sys/arch/amd64/amd64/intr.c:532 Xintr_ioapic_edge16_untramp() at Xintr_ioapic_edge16_untramp+0x18f __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x16 kd_curproc sys/dev/kcov.c:574 [inline] __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x16 sys/dev/kcov.c:148 __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 pool_put(ffffffff82b5b8e0,fffffd80677212e0) at pool_put+0x22c sys/kern/subr_pool.c:814 uvm_unmap_detach(ffff800021134fa0,1) at uvm_unmap_detach+0xee sys/uvm/uvm_map.c:1596 uvm_map_teardown(fffffd80772d4d00) at uvm_map_teardown+0x262 sys/uvm/uvm_map.c:2789 uvmspace_free(fffffd80772d4d00) at uvmspace_free+0xa6 sys/uvm/uvm_map.c:3685 reaper(ffff8000210f8fc0) at reaper+0x18b sys/kern/kern_exit.c:457 end trace frame: 0x0, count: -15 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(fffffd80772d4758,1,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(fffffd80772d4758,1,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_read(fffffd80772d4748) at rw_enter_read+0x66 sys/kern/kern_rwlock.c:112 uvmfault_lookup(ffff8000280f59e0,0) at uvmfault_lookup+0xd9 sys/uvm/uvm_fault.c:1758 uvm_fault_check(ffff8000280f59e0,ffff8000280f5a18,ffff8000280f5a40) at uvm_fault_check+0x3a sys/uvm/uvm_fault.c:674 uvm_fault(fffffd80772d4740,20000000,0,2) at uvm_fault+0x102 sys/uvm/uvm_fault.c:602 kpageflttrap(ffff8000280f5b70,20000300) at kpageflttrap+0x209 kerntrap(ffff8000280f5b70) 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,ffff8000280f5e20) at ifioctl_get+0x2dd soo_ioctl(fffffd80761b7850,c0106924,ffff8000280f5e20,ffff800025eaefd0) at soo_ioctl+0x26c sys_ioctl(ffff800025eaefd0,ffff8000280f5f38,ffff8000280f5f90) at sys_ioctl+0x4a2 syscall(ffff8000280f6000) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000280f6000) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xfa087c46590, count: -15