witness: lock order reversal: 1st 0xffffffff8290fe50 netlock (netlock) 2nd 0xfffffd806c705478 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(fffffd806c705478,1,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(fffffd806c705478,1,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_read(fffffd806c705468) at rw_enter_read+0x66 sys/kern/kern_rwlock.c:112 uvmfault_lookup(ffff80002345ed10,0) at uvmfault_lookup+0xd9 sys/uvm/uvm_fault.c:1758 uvm_fault_check(ffff80002345ed10,ffff80002345ed48,ffff80002345ed70) at uvm_fault_check+0x3a sys/uvm/uvm_fault.c:674 uvm_fault(fffffd806c705460,20000000,0,2) at uvm_fault+0x102 sys/uvm/uvm_fault.c:602 kpageflttrap(ffff80002345eea0,20000300) at kpageflttrap+0x209 kerntrap(ffff80002345eea0) 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,ffff80002345f150) at ifioctl_get+0x2dd soo_ioctl(fffffd80665ce7d0,c0106924,ffff80002345f150,ffff800022c43a48) at soo_ioctl+0x26c sys_ioctl(ffff800022c43a48,ffff80002345f268,ffff80002345f2c0) at sys_ioctl+0x4a2 syscall(ffff80002345f330) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002345f330) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xac65f659df0, count: -15 ddb{1}> show registers rdi 0x3 rsi 0xffffffff8294abb0 __sancov_gen_cov_switch_values.134 rbp 0xffff80002345ea00 rbx 0x3 rdx 0 rcx 0 rax 0xffff800022c43a48 r8 0xffff80002345e970 r9 0x8080808080808080 r10 0x349ec5325ca17e8e r11 0xef367033ac3249cd r12 0xffffffff82ab0640 w_lodata+0x52cd0 r13 0 r14 0xffffffff82aa47d0 w_lodata+0x46e60 r15 0xfffffd8002f62d80 rip 0xffffffff8138d658 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff80002345e9f0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.1) pid=32572 stat=onproc flags process=10 proc=4000000 pri=86, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffff80002972d7a0,0xffff800022c42018 process=0xffff80002122b620 user=0xffff80002345a000, vmspace=0xfffffd806c705460 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 28445 121961 69702 32767 2 0x10 syz-executor.4 96751 411938 77436 32767 7 0x10 syz-executor.0 96751 437834 77436 32767 3 0x4000090 fsleep syz-executor.0 96751 172973 77436 32767 2 0x4000010 syz-executor.0 2430 183287 3781 32767 2 0x10 syz-executor.7 2430 399549 3781 32767 3 0x4000090 fsleep syz-executor.7 20713 259427 33651 32767 2 0x10 syz-executor.2 20713 436614 33651 32767 3 0x4000090 fsleep syz-executor.2 20713 205280 33651 32767 2 0x4000010 syz-executor.2 20713 394554 33651 32767 3 0x4000090 fsleep syz-executor.2 20713 111978 33651 32767 2 0x4000010 syz-executor.2 64909 303376 78030 32767 2 0x10 syz-executor.3 64909 473591 78030 32767 3 0x4000090 fsleep syz-executor.3 51299 246826 62656 32767 2 0x10 syz-executor.1 *51299 32572 62656 32767 7 0x4000010 syz-executor.1 51299 379044 62656 32767 3 0x4000090 fsleep syz-executor.1 51299 223599 62656 32767 3 0x4000090 fsleep syz-executor.1 33651 334186 72317 32767 3 0x90 nanoslp syz-executor.2 72317 267720 57333 0 3 0x82 wait syz-executor.2 36491 371856 48393 32767 3 0x90 nanoslp syz-executor.5 48393 36985 57333 0 3 0x82 wait syz-executor.5 22893 371623 0 0 3 0x14200 bored sosplice 69367 174646 1649 32767 3 0x90 nanoslp syz-executor.6 3781 444430 63923 32767 3 0x90 nanoslp syz-executor.7 63923 478878 57333 0 3 0x82 wait syz-executor.7 1649 161157 57333 0 3 0x82 wait syz-executor.6 78030 94194 52413 32767 3 0x90 nanoslp syz-executor.3 69702 362213 41379 32767 3 0x90 nanoslp syz-executor.4 41379 485002 57333 0 3 0x82 wait syz-executor.4 52413 103548 57333 0 3 0x82 wait syz-executor.3 62656 516888 3478 32767 3 0x90 nanoslp syz-executor.1 3478 276766 57333 0 3 0x82 wait syz-executor.1 77436 130466 72447 32767 3 0x90 nanoslp syz-executor.0 72447 299061 57333 0 3 0x82 wait syz-executor.0 57333 435575 30879 0 3 0x82 thrsleep syz-fuzzer 57333 287369 30879 0 3 0x4000082 thrsleep syz-fuzzer 57333 290495 30879 0 3 0x4000082 thrsleep syz-fuzzer 57333 215603 30879 0 3 0x4000082 thrsleep syz-fuzzer 57333 23002 30879 0 3 0x4000082 kqread syz-fuzzer 57333 482276 30879 0 3 0x4000082 thrsleep syz-fuzzer 57333 431278 30879 0 3 0x4000082 thrsleep syz-fuzzer 57333 101263 30879 0 3 0x4000082 thrsleep syz-fuzzer 30879 394840 34486 0 3 0x10008a sigsusp ksh 34486 328703 89145 0 3 0x9a kqread sshd 95396 61413 1 0 3 0x100083 ttyin getty 89145 23311 1 0 3 0x88 kqread sshd 87640 209720 79424 73 3 0x1100090 kqread syslogd 79424 216878 1 0 3 0x100082 netio syslogd 56201 493089 1 0 3 0x100080 kqread resolvd 29656 157005 4211 77 3 0x100092 kqread dhcpleased 76042 194279 4211 77 3 0x100092 kqread dhcpleased 4211 365152 1 0 3 0x80 kqread dhcpleased 47657 93284 0 0 3 0x14200 bored smr 16788 322342 0 0 2 0x14200 zerothread 38476 51322 0 0 3 0x14200 aiodoned aiodoned 36605 463379 0 0 3 0x14200 syncer update 37707 477178 0 0 3 0x14200 cleaner cleaner 62920 164173 0 0 3 0x14200 reaper reaper 90031 313205 0 0 3 0x14200 pgdaemon pagedaemon 92762 329527 0 0 3 0x14200 bored viomb 24598 265337 0 0 3 0x40014200 acpi0 acpi0 73759 196349 0 0 3 0x40014200 idle1 27518 434946 0 0 3 0x14200 bored softnet 47934 521857 0 0 3 0x14200 bored systqmp 8255 266682 0 0 3 0x14200 bored systq 68306 435467 0 0 3 0x40014200 bored softclock 70613 35801 0 0 3 0x40014200 idle0 1 201635 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 51299 (syz-executor.1) thread 0xffff800022c43a48 (32572) 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 10193 6410K 6419K 78643K 11293 0 pcb 13 8K 8K 78643K 13 0 rtable 250 7K 7K 78643K 623 0 ifaddr 81 16K 16K 78643K 103 0 sysctl 2 0K 2K 78643K 7 0 counters 56 35K 35K 78643K 62 0 ioctlops 0 0K 2K 78643K 43 0 iov 0 0K 16K 78643K 212 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 5 0 vnodes 1271 79K 79K 78643K 1778 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 352 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 24 89K 121K 78643K 2497 0 sigio 0 0K 0K 78643K 129 0 proc 56 74K 111K 78643K 672 0 subproc 104 6K 6K 78643K 143 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 82 0 in_multi 99 6K 6K 78643K 138 0 ether_multi 1 0K 0K 78643K 4 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 175 784K 784K 78643K 175 0 exec 0 0K 2K 78643K 860 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 346 87K 95K 78643K 32444 0 UVM aobj 36 2K 2K 78643K 36 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 2 0K 0K 78643K 109 0 NDP 11 0K 2K 78643K 36 0 temp 124 4703K 4767K 78643K 9431 0 kqueue 12 18K 24K 78643K 137 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 256 0 253 5 4 1 3 0 8 0 rtentry 112 155 0 39 4 0 4 4 0 8 0 unpcb 136 3864 0 3851 31 28 3 10 0 8 2 syncache 296 21 0 21 5 5 0 1 0 8 0 tcpqe 32 38 0 38 2 2 0 1 0 8 0 tcpcb 736 1228 0 1203 33 25 8 15 0 8 5 arp 120 25 0 6 1 0 1 1 0 8 0 ipq 40 5 0 5 2 2 0 1 0 8 0 ipqe 40 179 0 179 2 2 0 1 0 8 0 inpcb 304 1826 0 1814 25 18 7 7 0 8 6 ip6q 72 1 0 1 1 1 0 1 0 8 0 nd6 48 43 0 14 1 0 1 1 0 8 0 kcovpl 48 11 0 3 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 623 0 138 31 0 31 31 0 8 0 art_table 32 624 0 138 4 0 4 4 0 8 0 art_node 16 154 0 48 1 0 1 1 0 8 0 sysvmsgpl 40 3 0 0 1 0 1 1 0 8 0 semupl 112 1 0 1 1 1 0 1 0 8 0 semapl 112 349 0 339 1 0 1 1 0 8 0 shmpl 112 33 0 0 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 4569 0 3138 90 0 90 90 0 8 0 ffsino 272 4569 0 3138 96 0 96 96 0 8 0 nchpl 144 7824 0 6197 62 0 62 62 0 8 0 uvmvnodes 80 4721 0 0 97 0 97 97 0 8 0 vnodes 224 4721 0 0 278 0 278 278 0 8 0 namei 1024 24990 0 24990 4 3 1 2 0 8 1 percpumem 16 43 0 3 1 0 1 1 0 8 0 scxspl 216 29716 0 29716 9 8 1 8 0 8 1 plimitpl 152 592 0 570 2 1 1 2 0 8 0 sigapl 424 2765 0 2713 7 1 6 7 0 8 0 futexpl 64 16950 0 16943 7 6 1 1 0 8 0 knotepl 120 248 0 0 7 0 7 7 0 8 0 kqueuepl 216 674 0 666 15 14 1 5 0 8 0 pipepl 336 943 0 915 29 21 8 8 0 8 5 fdescpl 496 2750 0 2715 7 2 5 6 0 8 0 filepl 152 17864 0 17628 56 39 17 24 0 8 7 lockfpl 104 323 0 321 1 0 1 1 0 8 0 lockfspl 48 83 0 81 1 0 1 1 0 8 0 sessionpl 144 26 0 10 1 0 1 1 0 8 0 pgrppl 48 26 0 10 1 0 1 1 0 8 0 ucredpl 96 2617 0 2599 1 0 1 1 0 8 0 zombiepl 144 2715 0 2713 1 0 1 1 0 8 0 processpl 1064 2765 0 2713 5 1 4 4 0 8 0 procpl 672 6706 0 6636 12 5 7 8 0 8 1 sosppl 168 27 0 27 3 3 0 1 0 8 0 sockpl 480 6113 0 6087 136 124 12 37 0 8 8 mcl64k 65536 20 0 0 3 1 2 3 0 8 0 mcl16k 16384 7 0 0 1 0 1 1 0 8 0 mcl12k 12288 15 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 17 0 0 3 0 3 3 0 8 0 mcl2k2 2112 4 0 0 1 0 1 1 0 8 0 mcl2k 2048 192 0 0 21 3 18 21 0 8 0 mtagpl 96 3 0 0 1 0 1 1 0 8 0 mbufpl 256 3580 0 0 224 0 224 224 0 8 0 bufpl 288 7298 0 963 453 0 453 453 0 8 0 anonpl 24 749191 0 735424 144 51 93 133 0 186 0 amapchunkpl 152 79465 0 78688 63 30 33 44 0 158 1 amappl16 200 7027 0 6650 64 43 21 45 0 8 0 amappl15 192 648 0 642 1 0 1 1 0 8 0 amappl14 184 38 0 33 1 0 1 1 0 8 0 amappl13 176 726 0 718 1 0 1 1 0 8 0 amappl12 168 330 0 326 1 0 1 1 0 8 0 amappl11 160 39 0 28 1 0 1 1 0 8 0 amappl10 152 44 0 41 1 0 1 1 0 8 0 amappl9 144 1011 0 1005 1 0 1 1 0 8 0 amappl8 136 979 0 906 3 0 3 3 0 8 0 amappl7 128 415 0 399 1 0 1 1 0 8 0 amappl6 120 758 0 734 2 1 1 2 0 8 0 amappl5 112 2608 0 2586 1 0 1 1 0 8 0 amappl4 104 926 0 895 2 1 1 2 0 8 0 amappl3 96 629 0 616 1 0 1 1 0 8 0 amappl2 88 1265 0 1218 3 1 2 3 0 8 0 amappl1 80 50503 0 49869 19 4 15 18 0 8 0 amappl 88 31899 0 31639 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 35 0 0 1 0 1 1 0 8 0 uaddrrnd 24 2750 0 2715 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 2750 0 2715 1 0 1 1 0 8 0 vmmpekpl 168 24211 0 24147 4 0 4 4 0 8 0 vmmpepl 168 249680 0 247047 162 39 123 137 0 357 5 vmsppl 368 2749 0 2715 4 0 4 4 0 8 0 rwobjpl 56 64218 0 58120 88 1 87 87 0 8 0 pdppl 4096 5507 0 5430 166 85 81 93 0 8 4 pvpl 32 1642833 0 1623777 277 86 191 259 0 265 24 pmappl 248 2749 0 2715 4 1 3 3 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 1168 0 140 30 0 30 30 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(ffff80002e3996c0,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+0x122 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff829de780) at __mp_lock+0x122 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: 0x7f7ffffcf180, 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(fffffd806c705478,1,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(fffffd806c705478,1,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_read(fffffd806c705468) at rw_enter_read+0x66 sys/kern/kern_rwlock.c:112 uvmfault_lookup(ffff80002345ed10,0) at uvmfault_lookup+0xd9 sys/uvm/uvm_fault.c:1758 uvm_fault_check(ffff80002345ed10,ffff80002345ed48,ffff80002345ed70) at uvm_fault_check+0x3a sys/uvm/uvm_fault.c:674 uvm_fault(fffffd806c705460,20000000,0,2) at uvm_fault+0x102 sys/uvm/uvm_fault.c:602 kpageflttrap(ffff80002345eea0,20000300) at kpageflttrap+0x209 kerntrap(ffff80002345eea0) 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,ffff80002345f150) at ifioctl_get+0x2dd soo_ioctl(fffffd80665ce7d0,c0106924,ffff80002345f150,ffff800022c43a48) at soo_ioctl+0x26c sys_ioctl(ffff800022c43a48,ffff80002345f268,ffff80002345f2c0) at sys_ioctl+0x4a2 syscall(ffff80002345f330) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002345f330) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xac65f659df0, count: -15