witness: lock order reversal: 1st 0xffffffff8290fe50 netlock (netlock) 2nd 0xfffffd806c27e8c8 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(fffffd806c27e8c8,1,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(fffffd806c27e8c8,1,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_read(fffffd806c27e8b8) at rw_enter_read+0x66 sys/kern/kern_rwlock.c:112 uvmfault_lookup(ffff8000294ec8e0,0) at uvmfault_lookup+0xd9 sys/uvm/uvm_fault.c:1758 uvm_fault_check(ffff8000294ec8e0,ffff8000294ec918,ffff8000294ec940) at uvm_fault_check+0x3a sys/uvm/uvm_fault.c:674 uvm_fault(fffffd806c27e8b0,20000000,0,2) at uvm_fault+0x102 sys/uvm/uvm_fault.c:602 kpageflttrap(ffff8000294eca70,20000300) at kpageflttrap+0x209 kerntrap(ffff8000294eca70) 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,ffff8000294ecd20) at ifioctl_get+0x2dd soo_ioctl(fffffd807d7a7ed8,c0106924,ffff8000294ecd20,ffff8000fffec010) at soo_ioctl+0x26c sys_ioctl(ffff8000fffec010,ffff8000294ece38,ffff8000294ece90) at sys_ioctl+0x4a2 syscall(ffff8000294ecf00) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000294ecf00) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x5aecd672c60, count: -15 ddb{0}> show registers rdi 0x3 rsi 0xffffffff8294abb0 __sancov_gen_cov_switch_values.134 rbp 0xffff8000294ec5d0 rbx 0x3 rdx 0 rcx 0 rax 0xffff8000fffec010 r8 0xffff8000294ec540 r9 0x8080808080808080 r10 0x9d490a846662f93c r11 0x225a1a282eb45148 r12 0xffffffff82ab06f0 w_lodata+0x52d80 r13 0 r14 0xffffffff82aa4460 w_lodata+0x46af0 r15 0xfffffd8002f62d80 rip 0xffffffff8138d658 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff8000294ec5c0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.3) pid=143533 stat=onproc flags process=10 proc=4000000 pri=32, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffff8000fffec550,0xffff8000fffed520 process=0xffff8000ffff0440 user=0xffff8000294e7000, vmspace=0xfffffd806c27e8b0 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 62904 95815 88776 32767 7 0x10 syz-executor.5 56116 332042 66664 32767 2 0x10 syz-executor.6 53208 203808 41671 32767 2 0x10 syz-executor.3 *53208 143533 41671 32767 7 0x4000010 syz-executor.3 92639 2723 50197 32767 3 0x90 nanoslp syz-executor.4 92639 95262 50197 32767 2 0x4000010 syz-executor.4 92639 125783 50197 32767 3 0x4000090 fsleep syz-executor.4 78767 222297 25915 32767 2 0x10 syz-executor.7 78767 3487 25915 32767 3 0x4000090 fsleep syz-executor.7 25915 430874 50510 32767 3 0x90 nanoslp syz-executor.7 50510 210506 59856 0 3 0x82 wait syz-executor.7 97301 1589 0 0 3 0x14200 bored sosplice 66664 396780 20718 32767 3 0x90 nanoslp syz-executor.6 20718 198530 59856 0 3 0x82 wait syz-executor.6 88776 412304 83275 32767 3 0x90 nanoslp syz-executor.5 83275 11343 59856 0 3 0x82 wait syz-executor.5 50197 240008 41282 32767 3 0x90 nanoslp syz-executor.4 41282 146803 59856 0 3 0x82 wait syz-executor.4 275 206581 81469 32767 3 0x90 piperd syz-executor.2 41671 79644 17422 32767 3 0x90 nanoslp syz-executor.3 5016 176833 11909 32767 3 0x90 piperd syz-executor.1 81469 186168 59856 0 3 0x82 wait syz-executor.2 17422 176065 59856 0 3 0x82 wait syz-executor.3 57713 259366 38805 32767 3 0x10 biowait syz-executor.0 11909 477762 59856 0 3 0x82 wait syz-executor.1 38805 135103 59856 0 3 0x82 wait syz-executor.0 59856 466800 1723 0 3 0x82 thrsleep syz-fuzzer 59856 80451 1723 0 3 0x4000082 nanoslp syz-fuzzer 59856 310946 1723 0 3 0x4000082 thrsleep syz-fuzzer 59856 381678 1723 0 3 0x4000082 kqread syz-fuzzer 59856 77805 1723 0 3 0x4000082 thrsleep syz-fuzzer 59856 468789 1723 0 3 0x4000082 thrsleep syz-fuzzer 59856 432638 1723 0 3 0x4000082 thrsleep syz-fuzzer 59856 472401 1723 0 3 0x4000082 thrsleep syz-fuzzer 1723 50954 23623 0 3 0x10008a sigsusp ksh 23623 509197 19729 0 3 0x9a kqread sshd 26979 33438 1 0 3 0x100083 ttyin getty 19729 370574 1 0 3 0x88 kqread sshd 20903 474806 44356 73 3 0x1100090 kqread syslogd 44356 394665 1 0 3 0x100082 netio syslogd 75560 93375 1 0 3 0x100080 kqread resolvd 60556 6760 21479 77 3 0x100092 kqread dhcpleased 43436 158333 21479 77 3 0x100092 kqread dhcpleased 21479 273910 1 0 3 0x80 kqread dhcpleased 99745 86817 0 0 3 0x14200 bored smr 96002 137023 0 0 2 0x14200 zerothread 88366 351337 0 0 3 0x14200 aiodoned aiodoned 62402 225072 0 0 3 0x14200 syncer update 71895 350065 0 0 3 0x14200 cleaner cleaner 28957 450178 0 0 3 0x14200 reaper reaper 3012 480690 0 0 3 0x14200 pgdaemon pagedaemon 45360 436313 0 0 3 0x14200 bored viomb 63779 419312 0 0 3 0x40014200 acpi0 acpi0 45522 370906 0 0 3 0x40014200 idle1 2958 524007 0 0 3 0x14200 bored softnet 12074 223170 0 0 3 0x14200 bored systqmp 32162 497381 0 0 3 0x14200 bored systq 53137 49850 0 0 3 0x40014200 bored softclock 50028 277420 0 0 3 0x40014200 idle0 1 257204 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 53208 (syz-executor.3) thread 0xffff8000fffec010 (143533) 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 Process 57713 (syz-executor.0) thread 0xffff8000ffff57a0 (259366) exclusive rrwlock inode r = 0 (0xfffffd807338aa38) #0 witness_lock+0x44d #1 rw_enter+0x3e1 sys/kern/kern_rwlock.c:310 #2 rrw_enter+0x8b sys/kern/kern_rwlock.c:461 #3 VOP_LOCK+0x87 sys/kern/vfs_vops.c:534 #4 ufs_ihashins+0x42 sys/ufs/ufs/ufs_ihash.c:140 #5 ffs_vget+0x141 sys/ufs/ffs/ffs_vfsops.c:1347 #6 ffs_inode_alloc+0x1be sys/ufs/ffs/ffs_alloc.c:394 #7 ufs_mkdir+0xf4 sys/ufs/ufs/ufs_vnops.c:1162 #8 VOP_MKDIR+0xbf sys/kern/vfs_vops.c:404 #9 domkdirat+0x121 sys/kern/vfs_syscalls.c:3101 #10 syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] #10 syscall+0x489 sys/arch/amd64/amd64/trap.c:585 #11 Xsyscall+0x128 exclusive rrwlock inode r = 0 (0xfffffd806ad4f928) #0 witness_lock+0x44d #1 rw_enter+0x3e1 sys/kern/kern_rwlock.c:310 #2 rrw_enter+0x8b sys/kern/kern_rwlock.c:461 #3 VOP_LOCK+0x87 sys/kern/vfs_vops.c:534 #4 vn_lock+0x84 sys/kern/vfs_vnops.c:579 #5 vfs_lookup+0xd1 sys/kern/vfs_lookup.c:413 #6 namei+0x36a sys/kern/vfs_lookup.c:245 #7 domkdirat+0x75 sys/kern/vfs_syscalls.c:3086 #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 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 10174 6407K 6419K 78643K 11273 0 pcb 13 12K 14K 78643K 17 0 rtable 248 7K 7K 78643K 1298 0 ifaddr 81 16K 16K 78643K 103 0 sysctl 2 0K 0K 78643K 2 0 counters 56 35K 35K 78643K 62 0 ioctlops 0 0K 2K 78643K 38 0 iov 0 0K 24K 78643K 422 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 5 0 vnodes 1270 79K 79K 78643K 1423 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 5K 78643K 5 0 VM map 2 1K 1K 78643K 2 0 sem 12 1K 1K 78643K 16 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 23 85K 117K 78643K 3642 0 sigio 0 0K 0K 78643K 6 0 proc 56 74K 111K 78643K 698 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 160 0 in_multi 99 6K 7K 78643K 172 0 ether_multi 1 0K 0K 78643K 14 0 mrt 1 0K 0K 78643K 1 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 61 281K 281K 78643K 61 0 exec 0 0K 2K 78643K 881 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 348 86K 91K 78643K 48196 0 UVM aobj 131 8K 8K 78643K 131 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 84 0 NDP 11 0K 2K 78643K 36 0 temp 125 4707K 4771K 78643K 12194 0 kqueue 12 18K 24K 78643K 221 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 1139 0 1136 16 12 4 4 0 8 3 rtentry 112 150 0 35 4 0 4 4 0 8 0 unpcb 136 1195 0 1182 13 11 2 5 0 8 1 syncache 296 37 0 37 6 5 1 1 0 8 1 tcpqe 32 32 0 32 4 3 1 1 0 8 1 tcpcb 736 1050 0 1034 42 34 8 14 0 8 6 arp 120 24 0 6 1 0 1 1 0 8 0 ipq 40 1 0 1 1 1 0 1 0 8 0 ipqe 40 5 0 5 1 1 0 1 0 8 0 inpcb 304 4074 0 4055 42 35 7 17 0 8 5 ip6q 72 6 0 6 2 1 1 1 0 8 1 ip6af 40 10 0 10 2 1 1 1 0 8 1 nd6 48 39 0 10 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 600 0 134 31 1 30 30 0 8 0 art_table 32 601 0 134 4 0 4 4 0 8 0 art_node 16 149 0 44 1 0 1 1 0 8 0 sysvmsgpl 40 21 0 15 1 0 1 1 0 8 0 semupl 112 3 0 3 1 1 0 1 0 8 0 semapl 112 10 0 0 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 5426 0 3997 90 0 90 90 0 8 0 ffsino 272 5426 0 3997 96 0 96 96 0 8 0 nchpl 144 10524 0 8901 62 0 62 62 0 8 0 uvmvnodes 80 5578 0 0 114 0 114 114 0 8 0 vnodes 224 5578 0 0 329 0 329 329 0 8 0 namei 1024 30008 0 30007 4 3 1 2 0 8 0 percpumem 16 43 0 3 1 0 1 1 0 8 0 scxspl 216 33545 0 33544 14 12 2 8 0 8 1 plimitpl 152 444 0 422 2 0 2 2 0 8 1 sigapl 424 3914 0 3865 7 1 6 7 0 8 0 futexpl 64 33628 0 33626 5 4 1 1 0 8 0 knotepl 120 284 0 0 9 0 9 9 0 8 0 kqueuepl 216 3421 0 3412 31 26 5 8 0 8 4 pipepl 336 761 0 733 28 25 3 8 0 8 0 fdescpl 496 3899 0 3865 7 2 5 6 0 8 0 filepl 152 24521 0 24280 43 28 15 17 0 8 5 lockfpl 104 441 0 439 2 1 1 2 0 8 0 lockfspl 48 115 0 113 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 1621 0 1603 1 0 1 1 0 8 0 zombiepl 144 3865 0 3865 1 0 1 1 0 8 1 processpl 1064 3914 0 3865 5 1 4 4 0 8 0 procpl 672 10540 0 10480 12 5 7 8 0 8 1 sosppl 168 72 0 72 5 4 1 1 0 8 1 sockpl 480 6445 0 6410 101 83 18 29 0 8 13 mcl64k 65536 15 0 0 2 0 2 2 0 8 0 mcl16k 16384 13 0 0 2 0 2 2 0 8 0 mcl12k 12288 17 0 0 2 0 2 2 0 8 0 mcl9k 9216 11 0 0 1 0 1 1 0 8 0 mcl8k 8192 17 0 0 3 0 3 3 0 8 0 mcl4k 4096 25 0 0 4 1 3 3 0 8 0 mcl2k2 2112 6 0 0 1 0 1 1 0 8 0 mcl2k 2048 184 0 0 19 1 18 19 0 8 0 mtagpl 96 3 0 0 1 0 1 1 0 8 0 mbufpl 256 691 0 0 34 0 34 34 0 8 0 bufpl 288 8542 0 2207 453 0 453 453 0 8 0 anonpl 24 1050269 0 1036481 138 44 94 115 0 186 1 amapchunkpl 152 114583 0 113867 52 19 33 42 0 158 2 amappl16 200 9358 0 8963 47 25 22 33 0 8 0 amappl15 192 265 0 259 1 0 1 1 0 8 0 amappl14 184 1341 0 1331 1 0 1 1 0 8 0 amappl13 176 99 0 98 1 0 1 1 0 8 0 amappl12 168 449 0 442 1 0 1 1 0 8 0 amappl11 160 292 0 282 1 0 1 1 0 8 0 amappl10 152 59 0 54 1 0 1 1 0 8 0 amappl9 144 956 0 949 1 0 1 1 0 8 0 amappl8 136 1600 0 1507 4 0 4 4 0 8 0 amappl7 128 970 0 951 1 0 1 1 0 8 0 amappl6 120 684 0 662 2 1 1 2 0 8 0 amappl5 112 3873 0 3851 1 0 1 1 0 8 0 amappl4 104 1217 0 1188 3 2 1 3 0 8 0 amappl3 96 876 0 861 1 0 1 1 0 8 0 amappl2 88 742 0 699 3 1 2 3 0 8 0 amappl1 80 73047 0 72431 18 3 15 18 0 8 0 amappl 88 47573 0 47333 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 3899 0 3865 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 3899 0 3865 1 0 1 1 0 8 0 vmmpekpl 168 32497 0 32438 3 0 3 3 0 8 0 vmmpepl 168 357838 0 355247 151 25 126 133 0 357 3 vmsppl 368 3898 0 3865 4 0 4 4 0 8 0 rwobjpl 56 91619 0 84561 102 2 100 100 0 8 0 pdppl 4096 7805 0 7730 157 76 81 91 0 8 6 pvpl 32 1885461 0 1866495 311 142 169 260 0 265 4 pmappl 248 3898 0 3865 4 1 3 3 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 976 0 143 24 0 24 24 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(fffffd806c27e8c8,1,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(fffffd806c27e8c8,1,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_read(fffffd806c27e8b8) at rw_enter_read+0x66 sys/kern/kern_rwlock.c:112 uvmfault_lookup(ffff8000294ec8e0,0) at uvmfault_lookup+0xd9 sys/uvm/uvm_fault.c:1758 uvm_fault_check(ffff8000294ec8e0,ffff8000294ec918,ffff8000294ec940) at uvm_fault_check+0x3a sys/uvm/uvm_fault.c:674 uvm_fault(fffffd806c27e8b0,20000000,0,2) at uvm_fault+0x102 sys/uvm/uvm_fault.c:602 kpageflttrap(ffff8000294eca70,20000300) at kpageflttrap+0x209 kerntrap(ffff8000294eca70) 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,ffff8000294ecd20) at ifioctl_get+0x2dd soo_ioctl(fffffd807d7a7ed8,c0106924,ffff8000294ecd20,ffff8000fffec010) at soo_ioctl+0x26c sys_ioctl(ffff8000fffec010,ffff8000294ece38,ffff8000294ece90) at sys_ioctl+0x4a2 syscall(ffff8000294ecf00) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000294ecf00) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x5aecd672c60, 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 syscall(ffff80002e3486f0) at syscall+0x3ef mi_syscall sys/sys/syscall_mi.h:93 [inline] syscall(ffff80002e3486f0) at syscall+0x3ef sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffd3fe0, count: -6