panic: kernel diagnostic assertion "sc->sc_dev == 0" failed: file "/syzkaller/managers/multicore/kernel/sys/net/if_tun.c", line 305 Stopped at db_enter+0x18: addq $0x8,%rsp TID PID UID PRFLAGS PFLAGS CPU COMMAND *493062 50863 0 0 0x4000000 0K syz-executor.3 52982 64753 0 0x14000 0x200 1 reaper db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:440 panic(ffffffff8257608c) at panic+0x177 sys/kern/subr_prf.c:202 __assert(ffffffff825ed4fc,ffffffff82634312,131,ffffffff825fed63) at __assert+0x25 sys/kern/subr_prf.c:161 tun_clone_destroy(ffff800000caf000) at tun_clone_destroy+0x278 sys/net/if_tun.c:305 if_clone_destroy(ffff80002c137900) at if_clone_destroy+0x132 sys/net/if.c:1218 soo_ioctl(fffffd8071fb4a30,80206979,ffff80002c137900,ffff800024e737a0) at soo_ioctl+0x26c sys_ioctl(ffff800024e737a0,ffff80002c137a18,ffff80002c137a70) at sys_ioctl+0x4a2 syscall(ffff80002c137ae0) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002c137ae0) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x164fbdd6250, count: 6 https://www.openbsd.org/ddb.html describes the minimum info required in bug reports. Insufficient info makes it difficult to find and fix bugs. ddb{0}> ddb{0}> set $lines = 0 ddb{0}> set $maxwidth = 0 ddb{0}> show panic *cpu0: kernel diagnostic assertion "sc->sc_dev == 0" failed: file "/syzkaller/managers/multicore/kernel/sys/net/if_tun.c", line 305 ddb{0}> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:440 panic(ffffffff8257608c) at panic+0x177 sys/kern/subr_prf.c:202 __assert(ffffffff825ed4fc,ffffffff82634312,131,ffffffff825fed63) at __assert+0x25 sys/kern/subr_prf.c:161 tun_clone_destroy(ffff800000caf000) at tun_clone_destroy+0x278 sys/net/if_tun.c:305 if_clone_destroy(ffff80002c137900) at if_clone_destroy+0x132 sys/net/if.c:1218 soo_ioctl(fffffd8071fb4a30,80206979,ffff80002c137900,ffff800024e737a0) at soo_ioctl+0x26c sys_ioctl(ffff800024e737a0,ffff80002c137a18,ffff80002c137a70) at sys_ioctl+0x4a2 syscall(ffff80002c137ae0) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002c137ae0) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x164fbdd6250, count: -9 ddb{0}> show registers rdi 0 rsi 0x1 rbp 0xffff80002c137710 rbx 0xffffffff828f5bff cpu_info_full_primary+0x2bff rdx 0 rcx 0 rax 0xffff800024e737a0 r8 0 r9 0x8080808080808080 r10 0xeff5fb8e5165282f r11 0x27ed474c2f4edb8a r12 0xffffffff828f5a00 cpu_info_full_primary+0x2a00 r13 0 r14 0 r15 0x1 rip 0xffffffff81b7c538 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff80002c137700 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.3) pid=493062 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=82, nice=20 forw=0xffffffffffffffff, list=0xffff800024e722a0,0xffff800024e72550 process=0xffff8000211b6dc8 user=0xffff80002c132000, vmspace=0xfffffd807b307750 estcpu=36, cpticks=2, pctcpu=0.0 user=0, sys=2, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 59521 192332 11429 0 2 0x480 syz-executor.1 59521 8649 11429 0 3 0x4000080 fsleep syz-executor.1 59521 146000 11429 0 3 0x4000080 fsleep syz-executor.1 50863 251429 76249 0 2 0 syz-executor.3 *50863 493062 76249 0 7 0x4000000 syz-executor.3 50863 167608 76249 0 3 0x4000080 fsleep syz-executor.3 33085 318519 20513 0 2 0x82000 syz-executor.5 33085 29054 20513 0 4 0x4082000 syz-executor.5 33085 454862 20513 0 2 0x4082000 syz-executor.5 33085 343525 20513 0 3 0x4002000 suspend syz-executor.5 24730 43707 69548 0 2 0x480 syz-executor.4 24730 378564 69548 0 3 0x4000080 netcon syz-executor.4 24730 139582 69548 0 3 0x4000080 fsleep syz-executor.4 24730 358166 69548 0 3 0x4000080 fsleep syz-executor.4 36885 314681 48321 0 2 0 syz-executor.2 36885 99097 48321 0 2 0x4000000 syz-executor.2 36885 61935 48321 0 2 0x4000000 syz-executor.2 47422 168101 45112 0 2 0x480 syz-executor.0 47422 77551 45112 0 3 0x4000080 kqsel syz-executor.0 47422 255249 45112 0 3 0x4000080 kqread syz-executor.0 23298 64772 63448 0 2 0x482 syz-executor.7 43339 39026 1 0 3 0x100083 ttyin getty 45112 200793 63448 0 2 0x482 syz-executor.0 76249 53187 63448 0 2 0x482 syz-executor.3 91827 464269 0 0 3 0x14200 acct acct 11429 139404 63448 0 2 0x482 syz-executor.1 48321 462944 63448 0 2 0x482 syz-executor.2 69548 4248 63448 0 2 0x482 syz-executor.4 77345 418708 0 0 3 0x14200 bored sosplice 68733 23238 63448 0 2 0x482 syz-executor.6 20513 61372 63448 0 2 0x482 syz-executor.5 63448 144471 99044 0 3 0x82 thrsleep syz-fuzzer 63448 236969 99044 0 3 0x4000082 thrsleep syz-fuzzer 63448 450696 99044 0 3 0x4000082 thrsleep syz-fuzzer 63448 394124 99044 0 3 0x4000082 thrsleep syz-fuzzer 63448 213073 99044 0 3 0x4000082 thrsleep syz-fuzzer 63448 152671 99044 0 3 0x4000082 thrsleep syz-fuzzer 63448 209748 99044 0 3 0x4000082 kqread syz-fuzzer 63448 283915 99044 0 3 0x4000082 thrsleep syz-fuzzer 63448 361780 99044 0 3 0x4000082 thrsleep syz-fuzzer 99044 465013 52575 0 3 0x10008a sigsusp ksh 52575 196875 60027 0 3 0x9a kqread sshd 60027 299923 1 0 3 0x88 kqread sshd 36335 187433 54009 74 3 0x1100092 bpf pflogd 54009 506193 1 0 3 0x80 netio pflogd 20658 266967 71850 73 3 0x1100090 kqread syslogd 71850 198729 1 0 3 0x100082 netio syslogd 63456 255084 1 0 3 0x100080 kqread resolvd 1706 260872 94555 77 2 0x100092 dhcpleased 10823 172874 94555 77 3 0x100092 kqread dhcpleased 94555 429931 1 0 3 0x80 kqread dhcpleased 67942 446521 0 0 3 0x14200 bored smr 93168 49657 0 0 2 0x14200 zerothread 45483 466763 0 0 3 0x14200 aiodoned aiodoned 6963 146471 0 0 3 0x14200 syncer update 30452 270698 0 0 3 0x14200 cleaner cleaner 64753 52982 0 0 7 0x14200 reaper 48600 462809 0 0 3 0x14200 pgdaemon pagedaemon 36428 363699 0 0 3 0x14200 bored viomb 89917 283091 0 0 3 0x40014200 acpi0 acpi0 80347 103365 0 0 3 0x40014200 idle1 67771 176870 0 0 3 0x14200 bored softnet 56278 481536 0 0 3 0x14200 bored systqmp 33826 142462 0 0 3 0x14200 bored systq 89621 385695 0 0 2 0x40014200 softclock 13637 19648 0 0 3 0x40014200 idle0 1 32200 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks CPU 1: exclusive mutex &uvm.fpageqlock r = 0 (0xffffffff82a15e10) #0 witness_lock+0x44d #1 mtx_enter_try+0x100 #2 mtx_enter+0x4b sys/kern/kern_lock.c:266 #3 uvm_pmr_freepages+0x10c sys/uvm/uvm_pmemrange.c:1289 #4 pmap_do_remove+0x666 sys/arch/amd64/amd64/pmap.c:1884 #5 uvm_unmap_kill_entry_withlock+0x1af sys/uvm/uvm_map.c:2139 #6 uvm_map_teardown+0x197 uvm_map_addr_RBT_LEFT sys/uvm/uvm_map.h:176 [inline] #6 uvm_map_teardown+0x197 sys/uvm/uvm_map.c:2771 #7 uvmspace_free+0xa6 sys/uvm/uvm_map.c:3685 #8 reaper+0x18b sys/kern/kern_exit.c:457 #9 proc_trampoline+0x1c Process 50863 (syz-executor.3) thread 0xffff800024e737a0 (493062) exclusive rwlock clonelk r = 0 (0xffffffff8299e970) #0 witness_lock+0x44d #1 if_clone_destroy+0x49 #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 (0xffffffff829eaf28) #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 10218 6560K 7509K 78643K 19631 0 pcb 13 13K 15K 78643K 603 0 rtable 154 16K 18K 78643K 1425 0 ifaddr 81 18K 20K 78643K 1022 0 sysctl 3 1K 1K 78643K 3 0 counters 54 35K 36K 78643K 180 0 ioctlops 0 0K 4K 78643K 3321 0 iov 0 0K 24K 78643K 450 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 4 0 vnodes 1514 95K 95K 78643K 3532 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 5K 78643K 35 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 0K 78643K 475 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 16 57K 85K 78643K 4192 0 sigio 0 0K 0K 78643K 374 0 proc 70 87K 111K 78643K 969 0 subproc 104 6K 6K 78643K 256 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 192 0 in_multi 54 3K 6K 78643K 311 0 ether_multi 1 0K 0K 78643K 42 0 mrt 1 0K 0K 78643K 33 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 1691 0 pfkey data 0 0K 0K 78643K 7 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 434 363K 363K 78643K 55616 0 UVM aobj 131 8K 8K 78643K 137 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 250 0 NDP 12 0K 2K 78643K 114 0 temp 139 4717K 4782K 78643K 58045 0 kqueue 13 20K 26K 78643K 359 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 522 0 519 9 8 1 4 0 8 0 rtentry 112 272 0 215 4 0 4 4 0 8 0 unpcb 136 10724 0 10709 52 49 3 10 0 8 2 syncache 296 15 0 15 5 5 0 1 0 8 0 tcpqe 32 188 0 188 4 4 0 1 0 8 0 tcpcb 736 1190 0 1178 44 42 2 12 0 8 0 arp 120 44 0 36 1 0 1 1 0 8 0 inpcb 304 3180 0 3168 54 50 4 11 0 8 3 rttmr 72 10 0 10 2 2 0 1 0 8 0 nd6 48 63 0 49 1 0 1 1 0 8 0 pkpcb 40 81 0 81 4 4 0 1 0 8 0 kcovpl 48 19 0 11 1 0 1 1 0 8 0 ppxss 1248 28 0 28 7 7 0 1 0 8 0 pfstscr 40 7 0 7 2 2 0 1 0 8 0 pffrag 232 64 0 64 3 2 1 1 0 482 1 pffrnode 88 64 0 64 3 2 1 1 0 8 1 pffrent 40 127 0 127 3 2 1 1 0 8 1 pfosfp 40 1428 0 1005 5 0 5 5 0 8 0 pfosfpen 112 1428 0 714 21 0 21 21 0 8 0 pfrktable 1344 220 0 213 2 1 1 1 0 8 0 pftag 88 13 0 6 1 0 1 1 0 8 0 pfstitem 24 18 0 16 1 0 1 1 0 8 0 pfstkey 112 28 0 26 1 0 1 1 0 8 0 pfstate 320 23 0 21 2 1 1 2 0 8 0 pfrule 1360 1057 0 1025 6 3 3 3 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 1079 0 799 31 5 26 29 0 8 2 art_table 32 1080 0 799 4 0 4 4 0 8 0 art_node 16 271 0 223 1 0 1 1 0 8 0 sysvmsgpl 40 121 0 100 1 0 1 1 0 8 0 semapl 112 473 0 463 1 0 1 1 0 8 0 shmpl 112 134 0 6 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 6849 0 5391 92 0 92 92 0 8 0 ffsino 272 6849 0 5391 98 0 98 98 0 8 0 nchpl 144 12426 0 10794 63 0 63 63 0 8 0 uvmvnodes 80 5926 0 0 121 0 121 121 0 8 0 vnodes 224 5926 0 0 349 0 349 349 0 8 0 namei 1024 45131 0 45131 7 6 1 2 0 8 1 percpumem 16 102 0 63 1 0 1 1 0 8 0 vcpupl 2048 18 0 0 3 0 3 3 0 8 0 vmpool 560 18 0 0 2 0 2 2 0 8 0 pfiaddrpl 120 159 0 149 2 1 1 1 0 8 0 scsiplug 72 4 0 4 1 1 0 1 0 8 0 scxspl 216 40354 0 40354 16 15 1 8 0 8 1 plimitpl 152 430 0 413 1 0 1 1 0 8 0 sigapl 424 4509 0 4462 8 1 7 8 0 8 0 futexpl 64 37257 0 37252 1 0 1 1 0 8 0 knotepl 120 354 0 0 10 1 9 9 0 8 0 kqueuepl 216 936 0 925 19 14 5 5 0 8 4 pipepl 336 815 0 787 17 14 3 8 0 8 0 fdescpl 496 4471 0 4442 5 1 4 5 0 8 0 filepl 152 35401 0 35152 75 60 15 22 0 8 2 lockfpl 104 1002 0 1000 2 1 1 2 0 8 0 lockfspl 48 283 0 281 1 0 1 1 0 8 0 sessionpl 144 37 0 20 1 0 1 1 0 8 0 pgrppl 48 120 0 103 1 0 1 1 0 8 0 ucredpl 96 3282 0 3268 1 0 1 1 0 8 0 zombiepl 144 4464 0 4462 2 1 1 1 0 8 0 processpl 1064 4509 0 4462 5 0 5 5 0 8 0 procpl 672 12774 0 12704 13 6 7 9 0 8 0 srpgc 96 14 0 14 5 4 1 1 0 8 1 sosppl 168 32 0 32 6 5 1 1 0 8 1 sockpl 480 14510 0 14480 372 360 12 37 0 8 8 mcl64k 65536 23 0 0 3 0 3 3 0 8 0 mcl16k 16384 17 0 0 3 1 2 3 0 8 0 mcl12k 12288 21 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 24 0 0 3 0 3 3 0 8 0 mcl2k2 2112 12 0 0 1 0 1 1 0 8 0 mcl2k 2048 232 0 0 23 2 21 23 0 8 0 mtagpl 96 254 0 0 5 0 5 5 0 8 0 mbufpl 256 763 0 0 38 0 38 38 0 8 0 bufpl 288 10852 0 4516 453 0 453 453 0 8 0 anonpl 24 1359140 0 1342100 235 90 145 180 0 186 8 amapchunkpl 152 133723 0 132828 81 44 37 64 0 158 1 amappl16 200 17819 0 17195 146 104 42 58 0 8 8 amappl15 192 1101 0 1094 1 0 1 1 0 8 0 amappl14 184 181 0 174 1 0 1 1 0 8 0 amappl13 176 1285 0 1280 1 0 1 1 0 8 0 amappl12 168 1232 0 1225 2 1 1 1 0 8 0 amappl11 160 45 0 31 1 0 1 1 0 8 0 amappl10 152 270 0 262 1 0 1 1 0 8 0 amappl9 144 511 0 508 1 0 1 1 0 8 0 amappl8 136 1264 0 1179 3 0 3 3 0 8 0 amappl7 128 532 0 520 1 0 1 1 0 8 0 amappl6 120 284 0 261 2 1 1 2 0 8 0 amappl5 112 3608 0 3586 1 0 1 1 0 8 0 amappl4 104 1316 0 1288 2 0 2 2 0 8 0 amappl3 96 1973 0 1955 1 0 1 1 0 8 0 amappl2 88 2469 0 2411 3 1 2 3 0 8 0 amappl1 80 84202 0 83577 22 8 14 19 0 8 0 amappl 88 54843 0 54539 8 0 8 8 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 136 0 6 3 0 3 3 0 8 0 uaddrrnd 24 4489 0 4441 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 4489 0 4441 1 0 1 1 0 8 0 vmmpekpl 168 38657 0 38584 4 0 4 4 0 8 0 vmmpepl 168 416704 0 413922 228 98 130 149 0 357 5 vmsppl 368 4488 0 4440 6 1 5 5 0 8 0 rwobjpl 56 113473 0 105699 120 7 113 113 0 8 1 pdppl 4096 8985 0 8898 273 186 87 87 0 8 0 pvpl 32 2326562 0 2304719 463 231 232 308 0 265 24 pmappl 248 4488 0 4440 5 1 4 4 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 1110 0 262 25 0 25 25 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 panic(ffffffff8257608c) at panic+0x177 sys/kern/subr_prf.c:202 __assert(ffffffff825ed4fc,ffffffff82634312,131,ffffffff825fed63) at __assert+0x25 sys/kern/subr_prf.c:161 tun_clone_destroy(ffff800000caf000) at tun_clone_destroy+0x278 sys/net/if_tun.c:305 if_clone_destroy(ffff80002c137900) at if_clone_destroy+0x132 sys/net/if.c:1218 soo_ioctl(fffffd8071fb4a30,80206979,ffff80002c137900,ffff800024e737a0) at soo_ioctl+0x26c sys_ioctl(ffff800024e737a0,ffff80002c137a18,ffff80002c137a70) at sys_ioctl+0x4a2 syscall(ffff80002c137ae0) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002c137ae0) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x164fbdd6250, count: -9 ddb{0}> machine ddbcpu 1 Stopped at x86_ipi_db+0x1a: addq $0x8,%rsp 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(ffffffff829ead20) at __mp_lock+0x122 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff829ead20) at __mp_lock+0x122 sys/kern/kern_lock.c:147 uvm_unmap_detach(ffff8000211350d0,1) at uvm_unmap_detach+0x113 sys/uvm/uvm_map.c:1615 uvm_map_teardown(fffffd807b338478) at uvm_map_teardown+0x262 sys/uvm/uvm_map.c:2789 uvmspace_free(fffffd807b338478) at uvmspace_free+0xa6 sys/uvm/uvm_map.c:3685 reaper(ffff8000210f9a40) at reaper+0x18b sys/kern/kern_exit.c:457 end trace frame: 0x0, count: 7 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(ffffffff829ead20) at __mp_lock+0x122 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff829ead20) at __mp_lock+0x122 sys/kern/kern_lock.c:147 uvm_unmap_detach(ffff8000211350d0,1) at uvm_unmap_detach+0x113 sys/uvm/uvm_map.c:1615 uvm_map_teardown(fffffd807b338478) at uvm_map_teardown+0x262 sys/uvm/uvm_map.c:2789 uvmspace_free(fffffd807b338478) at uvmspace_free+0xa6 sys/uvm/uvm_map.c:3685 reaper(ffff8000210f9a40) at reaper+0x18b sys/kern/kern_exit.c:457 end trace frame: 0x0, count: -8