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 * 93304 34282 0 0x2 0 0 ifconfig db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:438 panic(ffffffff834b5aff) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834f1eba,ffffffff8342a097,13f,ffffffff83433833) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff8000015ff000) at tun_clone_destroy+0x32d if_clone_destroy(ffff800037d2dd70) at if_clone_destroy+0x1d5 sys/net/if.c:1479 sys_ioctl(ffff80002a7847e0,ffff800037d2df40,ffff800037d2de90) at sys_ioctl+0x660 sys/kern/sys_generic.c:-1 syscall(ffff800037d2df40) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff800037d2df40) at syscall+0x962 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x79b8db4cc530, count: 7 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(ffffffff834b5aff) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834f1eba,ffffffff8342a097,13f,ffffffff83433833) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff8000015ff000) at tun_clone_destroy+0x32d if_clone_destroy(ffff800037d2dd70) at if_clone_destroy+0x1d5 sys/net/if.c:1479 sys_ioctl(ffff80002a7847e0,ffff800037d2df40,ffff800037d2de90) at sys_ioctl+0x660 sys/kern/sys_generic.c:-1 syscall(ffff800037d2df40) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff800037d2df40) at syscall+0x962 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x79b8db4cc530, count: -8 ddb> show registers rdi 0 rsi 0x1 rbp 0xffff800037d2dc00 rbx 0 rdx 0 rcx 0 rax 0xffff80002a7847e0 r8 0x101010101010101 r9 0x8080808080808080 r10 0xb7c566d3a4ec44d9 r11 0x848acc8526f17d1e r12 0 r13 0xffffffff83916100 tap_cloner r14 0 r15 0x1 rip 0xffffffff81299c45 db_enter+0x25 cs 0x8 rflags 0x246 rsp 0xffff800037d2dbf0 ss 0x10 db_enter+0x25: addq $0x8,%rsp ddb> show proc PROC (ifconfig) tid=93304 pid=34282 tcnt=1 stat=onproc flags process=2 proc=0 runpri=32, usrpri=78, slppri=32, nice=20 wchan=0x0, wmesg=, ps_single=0x0 scnt=0 ecnt=0 forw=0xffffffffffffffff, list=0xffff80002a784a78,0xffff80002a7854e8 process=0xffff80002a880db8 user=0xffff800037d28000, vmspace=0xfffff3806fa565c8 estcpu=36, cpticks=1, pctcpu=0.0, user=0, sys=1, intr=0 ddb> ps PID TID PPID UID S PRLAGS PFLAGS WAIT COMMAND 96237 460665 36815 0 3 0x2 0 clonelk ifconfig *34282 93304 17384 0 7 0x2 0 ifconfig 17384 265344 7697 0 3 0x100002 0x88 sigsusp sh 36815 378531 97307 0 3 0x100002 0x88 sigsusp sh 13116 95425 34835 0 2 0x2 0 ifconfig 34835 106654 96821 0 3 0x100002 0x88 sigsusp sh 7697 241999 75125 0 3 0x2 0x80 wait syz-executor 97307 152371 75125 0 3 0x2 0x80 wait syz-executor 96821 293875 75125 0 3 0x2 0x80 wait syz-executor 11256 195392 0 0 3 0x14000 0x280 nfsidl nfsio 93115 161409 0 0 3 0x14000 0x280 nfsidl nfsio 49340 399647 0 0 3 0x14000 0x280 nfsidl nfsio 8844 223251 0 0 3 0x14000 0x280 nfsidl nfsio 15093 457673 0 0 3 0x14000 0x280 nfsidl nfsio 6088 85940 0 0 3 0x14000 0x280 nfsidl nfsio 75641 168207 0 0 3 0x14000 0x280 nfsidl nfsio 4100 34125 0 0 3 0x14000 0x280 nfsidl nfsio 72956 438836 0 0 3 0x14000 0x280 nfsidl nfsio 95757 56833 0 0 3 0x14000 0x280 nfsidl nfsio 27375 115734 0 0 3 0x14000 0x280 nfsidl nfsio 74116 378294 0 0 3 0x14000 0x280 nfsidl nfsio 27440 289286 0 0 3 0x14000 0x280 nfsidl nfsio 57195 235965 0 0 3 0x14000 0x280 nfsidl nfsio 9818 203505 0 0 3 0x14000 0x280 nfsidl nfsio 73114 749 0 0 3 0x14000 0x280 nfsidl nfsio 8877 220914 0 0 3 0x14000 0x280 nfsidl nfsio 14108 113629 0 0 3 0x14000 0x280 nfsidl nfsio 465 410373 0 0 3 0x14000 0x280 nfsidl nfsio 88400 283 0 0 3 0x14000 0x280 nfsidl nfsio 55728 399055 75125 0 3 0x2 0x80 piperd syz-executor 79758 212203 75125 0 3 0x2 0x80 piperd syz-executor 75125 434415 69099 0 3 0x2 0x80 nanoslp syz-executor 69099 162331 55133 0 3 0x100002 0x88 sigsusp ksh 55133 13266 14785 0 3 0x10 0x88 kqread sshd-session 14785 367693 92120 0 3 0x12 0x80 kqread sshd-session 71094 244210 1 0 3 0x100003 0x80 ttyin getty 92120 173012 1 0 3 0 0x88 kqread sshd 79118 147369 65641 73 3 0x1100010 0x80 kqread syslogd 65641 445080 1 0 3 0x100002 0x80 sbwait syslogd-parent 20748 125803 1 0 3 0x100000 0x80 kqread resolvd 33073 471167 17235 77 2 0x100012 0 dhcpleased 29748 392463 17235 77 3 0x100012 0x80 kqread dhcpleased 17235 229420 1 0 3 0 0x80 kqread dhcpleased 91329 430873 0 0 3 0x14000 0x200 bored smr 72040 36802 0 0 3 0x14000 0x200 pgzero zerothread 61546 61616 0 0 3 0x14000 0x200 aiodoned aiodoned 58553 37255 0 0 3 0x14000 0x200 syncer update 76105 70316 0 0 3 0x14000 0x200 cleaner cleaner 79114 262379 0 0 3 0x14000 0x200 reaper reaper 84360 86087 0 0 3 0x14000 0x200 pgdaemon pagedaemon 65944 306601 0 0 3 0x14000 0x200 bored viomb 99512 367955 0 0 3 0x14000 0x40000200 acpi0 acpi0 82981 268843 0 0 3 0x14000 0x200 bored softnet0 31403 54624 0 0 3 0x14000 0x200 smrbar systqmp 72261 243034 0 0 3 0x14000 0x200 bored systq 17581 472241 0 0 3 0x14000 0x40000200 tmoslp softclock 21767 317724 0 0 3 0x14000 0x40000200 idle0 1 53731 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 11045 12098K 12294K 166960K 12367 0 pcb 17 12K 12K 166960K 32 0 rtable 134 4K 9K 166960K 1749 0 pf 22 11K 19K 166960K 161 0 ifaddr 23 4K 7K 166960K 232 0 ifgroup 34 1K 2K 166960K 240 0 sysctl 1 1K 9K 166960K 5 0 counters 29 17K 17K 166960K 82 0 ioctlops 0 0K 4K 166960K 102 0 iov 0 0K 12K 166960K 5 0 mount 1 1K 1K 166960K 1 0 log 0 0K 0K 166960K 4 0 vnodes 1294 81K 82K 166960K 1877 0 UFS quota 1 32K 32K 166960K 1 0 UFS mount 5 36K 36K 166960K 5 0 shm 2 1K 5K 166960K 4 0 VM map 2 1K 1K 166960K 2 0 sem 27 1K 1K 166960K 69 0 dirhash 12 2K 2K 166960K 15 0 ACPI 1734 201K 291K 166960K 11964 0 file desc 15 53K 97K 166960K 978 0 sigio 0 0K 0K 166960K 5 0 proc 81 83K 108K 166960K 1792 0 subproc 63 3K 4K 166960K 513 0 NFS srvsock 1 0K 0K 166960K 1 0 NFS daemon 1 16K 16K 166960K 1 0 ip_moptions 0 0K 0K 166960K 8 0 in_multi 44 2K 6K 166960K 595 0 ether_multi 1 0K 0K 166960K 1 0 mrt 0 0K 0K 166960K 18 0 ISOFS mount 1 32K 32K 166960K 1 0 MSDOSFS mount 1 16K 16K 166960K 1 0 ttys 223 996K 996K 166960K 223 0 exec 0 0K 2K 166960K 984 0 fusefs mount 1 32K 32K 166960K 1 0 tdb 3 0K 0K 166960K 3 0 VM swap 8 62K 64K 166960K 10 0 UVM amap 160 135K 151K 166960K 8038 0 UVM aobj 5 4K 4K 166960K 6 0 pinsyscall 36 72K 96K 166960K 3268 0 memdesc 1 4K 4K 166960K 1 0 crypto data 1 1K 1K 166960K 1 0 ip6_options 0 0K 0K 166960K 1 0 NDP 7 0K 2K 166960K 166 0 temp 33 9118K 9178K 166960K 14118 0 kqueue 13 20K 28K 166960K 52 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 135 0 132 1 0 1 1 0 8 0 rtentry 136 608 0 553 4 0 4 4 0 8 0 unpcb 144 105 0 90 1 0 1 1 0 8 0 syncache 336 5 0 5 1 0 1 1 0 8 1 tcpcb 736 33 0 29 1 0 1 1 0 8 0 arp 96 108 0 100 1 0 1 1 0 8 0 inpcb 328 395 0 385 2 0 2 2 0 8 1 ip6q 80 1 0 0 1 0 1 1 0 8 0 ip6af 40 1 0 0 1 0 1 1 0 8 0 nd6 112 159 0 150 1 0 1 1 0 8 0 kcovpl 48 57 0 50 1 0 1 1 0 8 0 ppxss 1072 3 0 3 1 0 1 1 0 8 1 pfrktable 1344 10 0 10 1 0 1 1 0 8 1 pfanchor 1288 4 0 1 1 0 1 1 0 8 0 pftag 88 2 0 2 1 0 1 1 0 8 1 pfrule 1360 2 0 1 1 0 1 1 0 8 0 rttmr 136 1 0 1 1 0 1 1 0 8 1 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 2488 0 2209 34 7 27 33 0 8 8 art_table 40 2489 0 2209 6 0 6 6 0 8 1 art_node 32 607 0 547 1 0 1 1 0 8 0 semapl 72 67 0 42 1 0 1 1 0 8 0 shmpl 120 3 0 1 1 0 1 1 0 8 0 dirhash 1024 19 0 2 3 0 3 3 0 8 0 dino2pl 256 1899 0 301 101 0 101 101 0 8 0 ffsino 256 1899 0 301 101 0 101 101 0 8 0 nchpl 144 2283 0 427 70 0 70 70 0 8 1 vnodes 216 2472 0 0 138 0 138 138 0 8 0 namei 1024 12793 0 12793 4 0 4 4 0 8 4 pfiaddrpl 120 3 0 3 1 0 1 1 0 8 1 kstatmem 264 121 0 106 2 0 2 2 0 8 0 scxspl 216 8730 0 8730 8 0 8 8 1 8 8 plimitpl 152 285 0 270 1 0 1 1 0 8 0 sigapl 424 1190 0 1130 8 0 8 8 0 8 0 knotepl 120 6059 0 6012 10 0 10 10 0 8 8 kqueuepl 184 61 0 52 1 0 1 1 0 8 0 pipepl 304 279 0 252 3 0 3 3 0 8 0 fdescpl 448 1157 0 1130 5 0 5 5 0 8 1 filepl 120 3455 0 3268 8 0 8 8 0 8 1 lockfpl 104 49 0 47 1 0 1 1 0 8 0 lockfspl 48 23 0 21 1 0 1 1 0 8 0 sessionpl 144 142 0 134 1 0 1 1 0 8 0 pgrppl 48 265 0 250 1 0 1 1 0 8 0 ucredpl 104 301 0 290 1 0 1 1 0 8 0 zombiepl 144 1132 0 1130 1 0 1 1 0 8 0 processpl 1160 1190 0 1130 5 0 5 5 0 8 0 procpl 664 1516 0 1456 6 0 6 6 0 8 0 sockpl 552 643 0 615 3 0 3 3 0 8 0 mcl64k 65536 1 0 1 1 0 1 1 0 8 1 mcl8k 8192 16 0 16 1 0 1 1 0 8 1 mcl4k 4096 2728 0 2672 15 0 15 15 0 8 6 mcl2k 2048 1127 0 1125 1 0 1 1 0 8 0 mextrefs 64 179 0 178 1 0 1 1 0 8 0 mtagpl 96 4 0 4 1 0 1 1 0 8 1 mbufpl 256 9267 0 9169 11 0 11 11 0 8 0 bufpl 272 3097 0 85 201 0 201 201 0 8 0 anonpl 24 134149 0 131369 43 0 43 43 0 187 23 amapchunkpl 152 21133 0 20858 22 0 22 22 0 158 7 amappl16 200 1380 0 1370 14 5 9 14 0 8 8 amappl15 192 97 0 97 1 0 1 1 0 8 1 amappl14 184 947 0 943 1 0 1 1 0 8 0 amappl13 176 205 0 195 1 0 1 1 0 8 0 amappl12 168 1577 0 1554 2 0 2 2 0 8 0 amappl10 152 58 0 49 1 0 1 1 0 8 0 amappl9 144 281 0 280 1 0 1 1 0 8 0 amappl8 136 271 0 267 1 0 1 1 0 8 0 amappl7 128 227 0 217 1 0 1 1 0 8 0 amappl6 120 386 0 382 1 0 1 1 0 8 0 amappl5 112 307 0 298 1 0 1 1 0 8 0 amappl4 104 402 0 387 1 0 1 1 0 8 0 amappl3 96 4495 0 4421 3 0 3 3 0 8 0 amappl2 88 632 0 584 2 0 2 2 0 8 0 amappl1 80 16648 0 16104 13 0 13 13 0 8 1 amappl 88 6572 0 6473 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 0 1 1 0 8 1 dma1024 1024 1 0 0 1 0 1 1 0 8 0 dma256 256 6 0 6 1 0 1 1 0 8 1 dma128 128 253 0 253 1 0 1 1 0 8 1 dma64 64 6 0 6 1 0 1 1 0 8 1 dma32 32 7 0 7 1 0 1 1 0 8 1 dma16 16 18 0 17 1 0 1 1 0 8 0 aobjpl 72 5 0 1 1 0 1 1 0 8 0 uaddrrnd 24 1157 0 1130 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 1157 0 1130 1 0 1 1 0 8 0 vmmpekpl 168 10334 0 10287 3 0 3 3 0 8 0 vmmpepl 168 82320 0 80870 81 0 81 81 0 357 8 vmsppl 368 1156 0 1130 4 0 4 4 0 8 1 rwobjpl 40 25178 0 24284 12 0 12 12 0 8 2 pdppl 4096 2320 0 2260 144 78 66 82 0 8 6 pvpl 32 414325 0 407241 106 0 106 106 0 265 38 pmappl 216 1156 0 1130 3 0 3 3 0 8 1 extentpl 40 46 0 28 1 0 1 1 0 8 0 phpool 112 633 0 85 16 0 16 16 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(ffffffff834b5aff) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834f1eba,ffffffff8342a097,13f,ffffffff83433833) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff8000015ff000) at tun_clone_destroy+0x32d if_clone_destroy(ffff800037d2dd70) at if_clone_destroy+0x1d5 sys/net/if.c:1479 sys_ioctl(ffff80002a7847e0,ffff800037d2df40,ffff800037d2de90) at sys_ioctl+0x660 sys/kern/sys_generic.c:-1 syscall(ffff800037d2df40) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff800037d2df40) at syscall+0x962 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x79b8db4cc530, count: -8 ddb> machine ddbcpu 1 No such command ddb> trace db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:438 panic(ffffffff834b5aff) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834f1eba,ffffffff8342a097,13f,ffffffff83433833) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff8000015ff000) at tun_clone_destroy+0x32d if_clone_destroy(ffff800037d2dd70) at if_clone_destroy+0x1d5 sys/net/if.c:1479 sys_ioctl(ffff80002a7847e0,ffff800037d2df40,ffff800037d2de90) at sys_ioctl+0x660 sys/kern/sys_generic.c:-1 syscall(ffff800037d2df40) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff800037d2df40) at syscall+0x962 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x79b8db4cc530, count: -8