panic: kernel diagnostic assertion "sc->sc_dev == 0" failed: file "/syzkaller/managers/main/kernel/sys/net/if_tun.c", line 319 Stopped at db_enter+0x25: addq $0x8,%rsp TID PID UID PRFLAGS PFLAGS CPU COMMAND *433350 23522 0 0 0x4000000 0 syz-executor db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:438 panic(ffffffff834bb0f8) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834fb8cf,ffffffff834331b8,13f,ffffffff8343d137) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff8000015f1000) at tun_clone_destroy+0x32d if_clone_destroy(ffff80003a143120) at if_clone_destroy+0x1d5 sys/net/if.c:1464 tun_dev_close(4287e,1db) at tun_dev_close+0x1d9 sys/net/if_tun.c:526 spec_close(ffff80003a1431e0) at spec_close+0x426 sys/kern/spec_vnops.c:-1 VOP_CLOSE(fffff5806a08e440,1,fffff58007ffd750,ffff80002a76efa8) at VOP_CLOSE+0x129 sys/kern/vfs_vops.c:156 vn_closefile(fffff58071a744c8,ffff80002a76efa8) at vn_closefile+0x11d vn_close sys/kern/vfs_vnops.c:298 [inline] vn_closefile(fffff58071a744c8,ffff80002a76efa8) at vn_closefile+0x11d sys/kern/vfs_vnops.c:621 fdrop(fffff58071a744c8,ffff80002a76efa8) at fdrop+0x121 sys/kern/kern_descrip.c:1281 closef(fffff58071a744c8,ffff80002a76efa8) at closef+0x190 sys/kern/kern_descrip.c:1265 finishdup(ffff80002a76efa8,fffff58071a74798,4,3,ffff80003a143430,2) at finishdup+0x46d sys/kern/kern_descrip.c:688 syscall(ffff80003a1434e0) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff80003a1434e0) at syscall+0x962 sys/arch/amd64/amd64/trap.c:804 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x2b8aaef4260, count: 1 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> ddb> set $lines = 0 ddb> set $maxwidth = 0 ddb> show panic *cpu0: kernel diagnostic assertion "sc->sc_dev == 0" failed: file "/syzkaller/managers/main/kernel/sys/net/if_tun.c", line 319 ddb> show kasan No such command ddb> trace db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:438 panic(ffffffff834bb0f8) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834fb8cf,ffffffff834331b8,13f,ffffffff8343d137) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff8000015f1000) at tun_clone_destroy+0x32d if_clone_destroy(ffff80003a143120) at if_clone_destroy+0x1d5 sys/net/if.c:1464 tun_dev_close(4287e,1db) at tun_dev_close+0x1d9 sys/net/if_tun.c:526 spec_close(ffff80003a1431e0) at spec_close+0x426 sys/kern/spec_vnops.c:-1 VOP_CLOSE(fffff5806a08e440,1,fffff58007ffd750,ffff80002a76efa8) at VOP_CLOSE+0x129 sys/kern/vfs_vops.c:156 vn_closefile(fffff58071a744c8,ffff80002a76efa8) at vn_closefile+0x11d vn_close sys/kern/vfs_vnops.c:298 [inline] vn_closefile(fffff58071a744c8,ffff80002a76efa8) at vn_closefile+0x11d sys/kern/vfs_vnops.c:621 fdrop(fffff58071a744c8,ffff80002a76efa8) at fdrop+0x121 sys/kern/kern_descrip.c:1281 closef(fffff58071a744c8,ffff80002a76efa8) at closef+0x190 sys/kern/kern_descrip.c:1265 finishdup(ffff80002a76efa8,fffff58071a74798,4,3,ffff80003a143430,2) at finishdup+0x46d sys/kern/kern_descrip.c:688 syscall(ffff80003a1434e0) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff80003a1434e0) at syscall+0x962 sys/arch/amd64/amd64/trap.c:804 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x2b8aaef4260, count: -14 ddb> show registers rdi 0 rsi 0x1 rbp 0xffff80003a142fb0 rbx 0x1 rdx 0xffff8000015f5580 rcx 0 rax 0xffff80002a76efa8 r8 0x101010101010101 r9 0x8080808080808080 r10 0x901b8a7e3b904b55 r11 0x88b74fa94a80f548 r12 0 r13 0xffffffff83923960 tun_cloner r14 0 r15 0x1 rip 0xffffffff832283b5 db_enter+0x25 cs 0x8 rflags 0x246 rsp 0xffff80003a142fa0 ss 0x10 db_enter+0x25: addq $0x8,%rsp ddb> show proc PROC (syz-executor) tid=433350 pid=23522 tcnt=3 stat=onproc flags process=0 proc=4000000 runpri=8, usrpri=50, slppri=8, nice=20 wchan=0x0, wmesg=, ps_single=0x0 scnt=0 ecnt=0 forw=0xffffffffffffffff, list=0xffff80002a74da00,0xffff80002a77a2c8 process=0xffff80002a77faf8 user=0xffff80003a13e000, vmspace=0xfffff5806cfad018 estcpu=0, cpticks=1, pctcpu=0.0, user=0, sys=1, intr=0 ddb> ps PID TID PPID UID S PRLAGS PFLAGS WAIT COMMAND 23522 347858 98846 0 2 0 0x1 syz-executor *23522 433350 98846 0 7 0 0x4000000 syz-executor 23522 506053 98846 0 3 0 0x4000080 fsleep syz-executor 59399 316934 35827 0 2 0 0x1 syz-executor 59399 499886 35827 0 3 0 0x4000080 fsleep syz-executor 59399 175309 35827 0 3 0 0x4000080 fsleep syz-executor 59399 50914 35827 0 3 0 0x4000080 fsleep syz-executor 26709 54193 30766 0 2 0 0 syz-executor 26709 186814 30766 0 3 0 0x4000080 fsleep syz-executor 26709 381435 30766 0 3 0 0x4000080 fsleep syz-executor 35827 377057 83856 0 2 0x2 0xc80 syz-executor 30766 372596 83856 0 2 0x2 0xc80 syz-executor 78948 15339 83856 0 2 0x2 0x1 syz-executor 98900 320480 83856 0 3 0x2 0x80 piperd syz-executor 87095 404475 83856 0 3 0x2 0x1 inode syz-executor 98846 424899 83856 0 2 0x2 0x1 syz-executor 67720 183410 83856 0 3 0x2 0x1 inode syz-executor 83856 131435 12213 0 3 0x2 0x80 wait syz-executor 12213 438710 7889 0 3 0x100002 0x88 sigsusp ksh 7889 146512 91774 0 3 0x10 0x88 kqread sshd-session 91774 496952 63825 0 3 0x12 0x80 kqread sshd-session 32185 294448 1 0 3 0x100003 0x80 ttyin getty 63825 185615 1 0 3 0 0x88 kqread sshd 66546 115762 30779 73 3 0x1100010 0x80 kqread syslogd 30779 361507 1 0 3 0x100002 0x80 sbwait syslogd-parent 27078 413582 1 0 3 0x100000 0x1 inode resolvd 41147 259304 76845 77 2 0x100012 0x1 dhcpleased 55665 66084 76845 77 3 0x100012 0x80 kqread dhcpleased 76845 426418 1 0 3 0 0x80 kqread dhcpleased 83392 155670 0 0 3 0x14000 0x200 bored smr 63355 481267 0 0 2 0x14000 0x200 zerothread 11975 291645 0 0 3 0x14000 0x200 aiodoned aiodoned 55483 45044 0 0 3 0x14000 0x200 syncer update 88041 252617 0 0 3 0x14000 0x200 cleaner cleaner 55005 340679 0 0 3 0x14000 0x200 reaper reaper 22977 304301 0 0 3 0x14000 0x200 pgdaemon pagedaemon 94507 288624 0 0 3 0x14000 0x200 bored viomb 57194 269842 0 0 3 0x14000 0x40000200 acpi0 acpi0 17064 319820 0 0 3 0x14000 0x200 bored softnet0 78530 444778 0 0 3 0x14000 0x200 smrbar systqmp 23497 487699 0 0 3 0x14000 0x200 bored systq 67948 204867 0 0 3 0x14000 0x40000200 tmoslp softclock 35789 435434 0 0 3 0x14000 0x40000200 idle0 1 113864 0 0 3 0x2 0x80 wait init 0 0 -1 0 3 0x10000 0x200 scheduler swapper ddb> show all locks No such command ddb> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 11029 12104K 12171K 166960K 12152 0 pcb 51 14K 14K 166960K 105 0 rtable 212 7K 8K 166960K 534 0 pf 31 13K 13K 166960K 47 0 ifaddr 39 6K 7K 166960K 72 0 ifgroup 51 2K 2K 166960K 81 0 sysctl 3 1K 9K 166960K 7 0 counters 33 17K 18K 166960K 42 0 ioctlops 0 0K 4K 166960K 116 0 iov 0 0K 16K 166960K 4 0 mount 1 1K 1K 166960K 1 0 log 0 0K 0K 166960K 4 0 vnodes 1292 81K 81K 166960K 1536 0 UFS quota 1 32K 32K 166960K 1 0 UFS mount 5 36K 36K 166960K 5 0 shm 2 1K 5K 166960K 3 0 VM map 2 1K 1K 166960K 2 0 sem 4 0K 0K 166960K 4 0 dirhash 12 2K 2K 166960K 18 0 ACPI 1692 195K 286K 166960K 12472 0 file desc 13 45K 93K 166960K 270 0 proc 60 59K 83K 166960K 669 0 subproc 72 4K 4K 166960K 126 0 NFS srvsock 1 0K 0K 166960K 1 0 NFS daemon 1 16K 16K 166960K 1 0 in_multi 88 5K 6K 166960K 165 0 ether_multi 1 0K 0K 166960K 1 0 mrt 0 0K 0K 166960K 5 0 ISOFS mount 1 32K 32K 166960K 1 0 MSDOSFS mount 1 16K 16K 166960K 1 0 ttys 49 228K 228K 166960K 49 0 exec 0 0K 1K 166960K 451 0 fusefs mount 1 32K 32K 166960K 1 0 tdb 3 0K 0K 166960K 3 0 VM swap 14 124K 124K 166960K 15 0 UVM amap 187 149K 158K 166960K 3869 0 UVM aobj 4 2K 2K 166960K 5 0 pinsyscall 34 68K 95K 166960K 1520 0 memdesc 1 4K 4K 166960K 1 0 crypto data 1 1K 1K 166960K 1 0 ip6_options 0 0K 0K 166960K 4 0 NDP 11 0K 2K 166960K 47 0 temp 34 9118K 9182K 166960K 5153 0 kqueue 13 20K 25K 166960K 33 0 SYN cache 2 16K 16K 166960K 2 0 ddb> show all pools Name Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle rtpcb 120 55 0 52 1 0 1 1 0 8 0 rtentry 136 177 0 78 4 0 4 4 0 8 0 unpcb 144 152 0 137 2 1 1 2 0 8 0 syncache 336 4 0 4 1 1 0 1 0 8 0 tcpcb 736 18 0 14 1 0 1 1 0 8 0 arp 96 30 0 14 1 0 1 1 0 8 0 ipq 40 2 0 0 1 0 1 1 0 8 0 ipqe 40 2 0 0 1 0 1 1 0 8 0 inpcb 328 179 0 138 7 3 4 4 0 8 0 nd6 112 42 0 21 1 0 1 1 0 8 0 pkpcb 40 1 0 1 1 0 1 1 0 8 1 kcovpl 48 14 0 6 1 0 1 1 0 8 0 ppxss 1072 2 0 2 1 1 0 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 719 0 264 32 0 32 32 0 8 2 art_table 40 720 0 264 6 0 6 6 0 8 0 art_node 32 177 0 77 1 0 1 1 0 8 0 semapl 72 2 0 0 1 0 1 1 0 8 0 shmpl 120 2 0 1 1 0 1 1 0 8 0 dirhash 1024 21 0 4 3 0 3 3 0 8 0 dino2pl 256 1757 0 282 93 0 93 93 0 8 0 ffsino 256 1757 0 282 93 0 93 93 0 8 0 nchpl 144 1994 0 287 64 0 64 64 0 8 0 vnodes 216 1907 0 0 106 0 106 106 0 8 0 namei 1024 7348 0 7348 4 3 1 4 0 8 1 kstatmem 264 39 0 16 2 0 2 2 0 8 0 scxspl 216 6471 0 6471 3 2 1 3 1 8 1 plimitpl 152 40 0 24 1 0 1 1 0 8 0 sigapl 424 545 0 507 6 0 6 6 0 8 0 knotepl 120 3678 0 3631 8 6 2 8 0 8 0 kqueuepl 184 37 0 28 1 0 1 1 0 8 0 pipepl 304 143 0 116 3 0 3 3 0 8 0 fdescpl 448 532 0 507 5 1 4 5 0 8 0 filepl 120 2255 0 2012 8 0 8 8 0 8 0 lockfpl 104 26 0 24 1 0 1 1 0 8 0 lockfspl 48 12 0 10 1 0 1 1 0 8 0 sessionpl 144 31 0 23 1 0 1 1 0 8 0 pgrppl 48 45 0 29 1 0 1 1 0 8 0 ucredpl 104 422 0 411 1 0 1 1 0 8 0 zombiepl 144 517 0 516 2 1 1 1 0 8 0 processpl 1160 545 0 507 4 0 4 4 0 8 0 procpl 664 640 0 595 7 1 6 6 0 8 0 sockpl 552 390 0 331 8 3 5 5 0 8 0 mcl64k 65536 2 0 2 1 1 0 1 0 8 0 mcl8k 8192 12 0 12 1 1 0 1 0 8 0 mcl4k 4096 2600 0 2545 14 6 8 14 0 8 0 mcl2k 2048 270 0 268 3 2 1 3 0 8 0 mextrefs 64 92 0 91 1 0 1 1 0 8 0 mtagpl 96 4 0 4 1 1 0 1 0 8 0 mbufpl 256 5597 0 5442 13 0 13 13 0 8 0 bufpl 272 2408 0 86 155 0 155 155 0 8 0 anonpl 24 93840 0 91075 21 0 21 21 0 187 0 amapchunkpl 152 10459 0 10104 23 2 21 21 0 158 1 amappl16 200 1393 0 1377 5 3 2 4 0 8 0 amappl15 192 8 0 8 1 1 0 1 0 8 0 amappl14 184 474 0 472 1 0 1 1 0 8 0 amappl13 176 130 0 120 1 0 1 1 0 8 0 amappl12 168 838 0 814 2 0 2 2 0 8 0 amappl11 160 6 0 6 1 1 0 1 0 8 0 amappl10 152 61 0 53 1 0 1 1 0 8 0 amappl9 144 287 0 287 1 1 0 1 0 8 0 amappl8 136 114 0 112 1 0 1 1 0 8 0 amappl7 128 162 0 151 1 0 1 1 0 8 0 amappl6 120 146 0 144 1 0 1 1 0 8 0 amappl5 112 155 0 148 1 0 1 1 0 8 0 amappl4 104 276 0 262 1 0 1 1 0 8 0 amappl3 96 2034 0 1948 5 1 4 4 0 8 0 amappl2 88 453 0 406 2 0 2 2 0 8 0 amappl1 80 10955 0 10433 13 1 12 13 0 8 0 amappl 88 3100 0 2974 4 0 4 4 0 92 0 uvmvnodes 80 101 0 0 3 0 3 3 0 8 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 4 0 1 1 0 1 1 0 8 0 uaddrrnd 24 532 0 507 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 532 0 507 1 0 1 1 0 8 0 vmmpekpl 168 5961 0 5904 3 0 3 3 0 8 0 vmmpepl 168 43268 0 41745 83 3 80 80 0 357 2 vmsppl 368 531 0 507 4 1 3 4 0 8 0 rwobjpl 40 15402 0 14520 11 0 11 11 0 8 0 pdppl 4096 1070 0 1014 98 30 68 80 0 8 12 pvpl 32 240513 0 233249 81 10 71 81 0 265 0 pmappl 216 531 0 507 3 0 3 3 0 8 0 extentpl 40 46 0 28 1 0 1 1 0 8 0 phpool 112 525 0 48 15 0 15 15 0 8 0 ddb> machine ddbcpu 0 No such command ddb> trace db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:438 panic(ffffffff834bb0f8) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834fb8cf,ffffffff834331b8,13f,ffffffff8343d137) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff8000015f1000) at tun_clone_destroy+0x32d if_clone_destroy(ffff80003a143120) at if_clone_destroy+0x1d5 sys/net/if.c:1464 tun_dev_close(4287e,1db) at tun_dev_close+0x1d9 sys/net/if_tun.c:526 spec_close(ffff80003a1431e0) at spec_close+0x426 sys/kern/spec_vnops.c:-1 VOP_CLOSE(fffff5806a08e440,1,fffff58007ffd750,ffff80002a76efa8) at VOP_CLOSE+0x129 sys/kern/vfs_vops.c:156 vn_closefile(fffff58071a744c8,ffff80002a76efa8) at vn_closefile+0x11d vn_close sys/kern/vfs_vnops.c:298 [inline] vn_closefile(fffff58071a744c8,ffff80002a76efa8) at vn_closefile+0x11d sys/kern/vfs_vnops.c:621 fdrop(fffff58071a744c8,ffff80002a76efa8) at fdrop+0x121 sys/kern/kern_descrip.c:1281 closef(fffff58071a744c8,ffff80002a76efa8) at closef+0x190 sys/kern/kern_descrip.c:1265 finishdup(ffff80002a76efa8,fffff58071a74798,4,3,ffff80003a143430,2) at finishdup+0x46d sys/kern/kern_descrip.c:688 syscall(ffff80003a1434e0) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff80003a1434e0) at syscall+0x962 sys/arch/amd64/amd64/trap.c:804 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x2b8aaef4260, count: -14 ddb> machine ddbcpu 1 No such command ddb> trace db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:438 panic(ffffffff834bb0f8) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834fb8cf,ffffffff834331b8,13f,ffffffff8343d137) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff8000015f1000) at tun_clone_destroy+0x32d if_clone_destroy(ffff80003a143120) at if_clone_destroy+0x1d5 sys/net/if.c:1464 tun_dev_close(4287e,1db) at tun_dev_close+0x1d9 sys/net/if_tun.c:526 spec_close(ffff80003a1431e0) at spec_close+0x426 sys/kern/spec_vnops.c:-1 VOP_CLOSE(fffff5806a08e440,1,fffff58007ffd750,ffff80002a76efa8) at VOP_CLOSE+0x129 sys/kern/vfs_vops.c:156 vn_closefile(fffff58071a744c8,ffff80002a76efa8) at vn_closefile+0x11d vn_close sys/kern/vfs_vnops.c:298 [inline] vn_closefile(fffff58071a744c8,ffff80002a76efa8) at vn_closefile+0x11d sys/kern/vfs_vnops.c:621 fdrop(fffff58071a744c8,ffff80002a76efa8) at fdrop+0x121 sys/kern/kern_descrip.c:1281 closef(fffff58071a744c8,ffff80002a76efa8) at closef+0x190 sys/kern/kern_descrip.c:1265 finishdup(ffff80002a76efa8,fffff58071a74798,4,3,ffff80003a143430,2) at finishdup+0x46d sys/kern/kern_descrip.c:688 syscall(ffff80003a1434e0) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff80003a1434e0) at syscall+0x962 sys/arch/amd64/amd64/trap.c:804 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x2b8aaef4260, count: -14