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 * 59638 71926 0 0x2 0 0 ifconfig db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:438 panic(ffffffff834adf53) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834f0459,ffffffff8342614c,13f,ffffffff8342f7be) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff8000015ea000) at tun_clone_destroy+0x32d if_clone_destroy(ffff80003c8cfb40) at if_clone_destroy+0x1d5 sys/net/if.c:1464 sys_ioctl(ffff80002a7c6fb8,ffff80003c8cfd10,ffff80003c8cfc60) at sys_ioctl+0x660 sys/kern/sys_generic.c:-1 syscall(ffff80003c8cfd10) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff80003c8cfd10) at syscall+0x962 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x77dead2842a0, 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(ffffffff834adf53) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834f0459,ffffffff8342614c,13f,ffffffff8342f7be) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff8000015ea000) at tun_clone_destroy+0x32d if_clone_destroy(ffff80003c8cfb40) at if_clone_destroy+0x1d5 sys/net/if.c:1464 sys_ioctl(ffff80002a7c6fb8,ffff80003c8cfd10,ffff80003c8cfc60) at sys_ioctl+0x660 sys/kern/sys_generic.c:-1 syscall(ffff80003c8cfd10) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff80003c8cfd10) at syscall+0x962 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x77dead2842a0, count: -8 ddb> show registers rdi 0 rsi 0x1 rbp 0xffff80003c8cf9d0 rbx 0 rdx 0 rcx 0 rax 0xffff80002a7c6fb8 r8 0x101010101010101 r9 0x8080808080808080 r10 0x4b18156561584163 r11 0x79ce4268ea5b253 r12 0 r13 0xffffffff838d8b40 tap_cloner r14 0 r15 0x1 rip 0xffffffff81720df5 db_enter+0x25 cs 0x8 rflags 0x246 rsp 0xffff80003c8cf9c0 ss 0x10 db_enter+0x25: addq $0x8,%rsp ddb> show proc PROC (ifconfig) tid=59638 pid=71926 tcnt=1 stat=onproc flags process=2 proc=0 runpri=32, usrpri=50, slppri=32, nice=20 wchan=0x0, wmesg=, ps_single=0x0 scnt=0 ecnt=0 forw=0xffffffffffffffff, list=0xffff80002a7c62c0,0xffffffff83a46400 process=0xffff800045ff8928 user=0xffff80003c8ca000, vmspace=0xfffffc006d0ccd00 estcpu=36, cpticks=1, pctcpu=0.0, user=0, sys=1, intr=0 ddb> ps PID TID PPID UID S PRLAGS PFLAGS WAIT COMMAND *71926 59638 88403 0 7 0x2 0 ifconfig 88403 74327 94840 0 3 0x100002 0x88 sigsusp sh 94840 398901 85527 0 3 0x2 0x80 wait syz-executor 75349 201710 60514 0 2 0x2 0 ifconfig 60514 395422 12196 0 3 0x100002 0x88 sigsusp sh 72049 263582 54352 0 2 0x1000 0x2000 syz-executor 90578 518376 17559 60928 2 0x11 0xc80 syz-executor 90578 200158 17559 60928 3 0x11 0x4000080 rest syz-executor 90578 236596 17559 60928 3 0x11 0x4000080 kqread syz-executor 90578 62484 17559 60928 3 0x11 0x4000080 fsleep syz-executor 12196 474005 85527 0 3 0x2 0x80 wait syz-executor 54352 191203 85527 0 3 0x2 0x80 nanoslp syz-executor 17559 398942 85527 0 3 0x2 0x80 nanoslp syz-executor 68588 248865 85527 0 3 0x2 0x80 piperd syz-executor 65644 119660 85527 0 3 0x2 0x80 piperd syz-executor 85527 469511 24849 0 3 0x2 0x80 wait syz-executor 24849 378344 39351 0 3 0x100002 0x88 sigsusp ksh 39351 54096 39548 0 3 0x10 0x88 kqread sshd-session 39548 387066 71764 0 3 0x12 0x80 kqread sshd-session 68399 195346 1 0 3 0x100003 0x80 ttyin getty 71764 56364 1 0 3 0 0x88 kqread sshd 13894 438536 93048 73 3 0x1100010 0x80 kqread syslogd 93048 60232 1 0 3 0x100002 0x80 sbwait syslogd-parent 83226 282434 1 0 3 0x100000 0x80 kqread resolvd 73673 133258 17321 77 2 0x100012 0 dhcpleased 42366 381169 17321 77 3 0x100012 0x80 kqread dhcpleased 17321 312804 1 0 3 0 0x80 kqread dhcpleased 16827 491639 0 0 3 0x14000 0x200 bored smr 19207 292370 0 0 3 0x14000 0x200 pgzero zerothread 95851 466712 0 0 3 0x14000 0x200 aiodoned aiodoned 11482 40814 0 0 3 0x14000 0x200 syncer update 80227 415085 0 0 3 0x14000 0x200 cleaner cleaner 64768 512122 0 0 3 0x14000 0x200 reaper reaper 94139 524121 0 0 3 0x14000 0x200 pgdaemon pagedaemon 99346 113289 0 0 3 0x14000 0x200 bored viomb 49897 229358 0 0 3 0x14000 0x40000200 acpi0 acpi0 70948 101415 0 0 3 0x14000 0x200 bored softnet0 62574 402443 0 0 3 0x14000 0x200 smrbar systqmp 41734 29576 0 0 3 0x14000 0x200 bored systq 50311 422898 0 0 3 0x14000 0x40000200 tmoslp softclock 3820 491331 0 0 3 0x14000 0x40000200 idle0 1 117884 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 11019 12096K 12118K 166960K 12130 0 pcb 17 12K 12K 166960K 18 0 rtable 131 4K 6K 166960K 404 0 pf 24 12K 12K 166960K 36 0 ifaddr 26 4K 7K 166960K 53 0 ifgroup 38 1K 2K 166960K 62 0 sysctl 1 1K 9K 166960K 5 0 counters 30 17K 17K 166960K 36 0 ioctlops 0 0K 2K 166960K 34 0 iov 0 0K 2K 166960K 1 0 mount 1 1K 1K 166960K 1 0 log 0 0K 0K 166960K 4 0 vnodes 1289 81K 81K 166960K 1414 0 UFS quota 1 32K 32K 166960K 1 0 UFS mount 5 36K 36K 166960K 5 0 shm 2 1K 1K 166960K 2 0 VM map 2 1K 1K 166960K 2 0 sem 5 0K 0K 166960K 5 0 dirhash 12 2K 2K 166960K 12 0 ACPI 1734 201K 291K 166960K 11964 0 file desc 15 53K 93K 166960K 203 0 proc 74 75K 116K 166960K 571 0 subproc 63 3K 4K 166960K 108 0 NFS srvsock 1 0K 0K 166960K 1 0 NFS daemon 1 16K 16K 166960K 1 0 ip_moptions 0 0K 0K 166960K 1 0 in_multi 54 3K 6K 166960K 121 0 ether_multi 1 0K 0K 166960K 1 0 mrt 0 0K 0K 166960K 2 0 ISOFS mount 1 32K 32K 166960K 1 0 MSDOSFS mount 1 16K 16K 166960K 1 0 ttys 43 201K 201K 166960K 43 0 exec 0 0K 1K 166960K 409 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 206 135K 158K 166960K 3362 0 UVM aobj 3 2K 2K 166960K 3 0 pinsyscall 36 72K 94K 166960K 1357 0 memdesc 1 4K 4K 166960K 1 0 crypto data 1 1K 1K 166960K 1 0 NDP 8 0K 2K 166960K 34 0 temp 31 9114K 9135K 166960K 3982 0 kqueue 13 20K 28K 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 42 0 39 1 0 1 1 0 8 0 rtentry 136 133 0 71 4 0 4 4 0 8 0 unpcb 144 49 0 34 1 0 1 1 0 8 0 syncache 336 4 0 4 1 0 1 1 0 8 1 tcpcb 736 57 0 51 4 0 4 4 0 8 2 arp 96 22 0 14 1 0 1 1 0 8 0 inpcb 328 132 0 120 5 0 5 5 0 8 3 nd6 112 30 0 18 1 0 1 1 0 8 0 kcovpl 48 12 0 5 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 541 0 224 29 0 29 29 0 8 5 art_table 40 542 0 224 5 0 5 5 0 8 0 art_node 32 133 0 67 1 0 1 1 0 8 0 sysvmsgpl 40 1 0 1 1 0 1 1 0 8 1 semupl 112 2 0 2 1 0 1 1 0 8 1 semapl 72 3 0 0 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 1627 0 156 93 0 93 93 0 8 0 ffsino 256 1627 0 156 93 0 93 93 0 8 0 nchpl 144 1859 0 155 64 0 64 64 0 8 0 vnodes 216 1753 0 0 98 0 98 98 0 8 0 namei 1024 6566 0 6566 3 0 3 3 0 8 3 kstatmem 264 29 0 12 2 0 2 2 0 8 0 scsiplug 72 1 0 1 1 0 1 1 0 8 1 scxspl 216 6800 0 6800 4 0 4 4 1 8 4 plimitpl 152 35 0 19 1 0 1 1 0 8 0 sigapl 424 482 0 441 6 0 6 6 0 8 1 knotepl 120 4025 0 3980 17 0 17 17 0 8 14 kqueuepl 184 32 0 22 1 0 1 1 0 8 0 pipepl 304 139 0 112 3 0 3 3 0 8 0 fdescpl 448 469 0 442 5 0 5 5 0 8 1 filepl 120 1782 0 1586 10 0 10 10 0 8 2 lockfpl 104 16 0 14 1 0 1 1 0 8 0 lockfspl 48 9 0 7 1 0 1 1 0 8 0 sessionpl 144 30 0 21 1 0 1 1 0 8 0 pgrppl 48 44 0 27 1 0 1 1 0 8 0 ucredpl 104 112 0 99 1 0 1 1 0 8 0 zombiepl 144 444 0 441 1 0 1 1 0 8 0 processpl 1160 482 0 441 4 0 4 4 0 8 0 procpl 664 583 0 539 6 0 6 6 0 8 1 sockpl 552 223 0 193 6 0 6 6 0 8 3 mcl64k 65536 1 0 1 1 0 1 1 0 8 1 mcl8k 8192 12 0 12 1 0 1 1 0 8 1 mcl4k 4096 2600 0 2547 14 0 14 14 0 8 6 mcl2k 2048 213 0 211 1 0 1 1 0 8 0 mextrefs 64 48 0 46 1 0 1 1 0 8 0 mtagpl 96 4 0 4 1 0 1 1 0 8 1 mbufpl 256 4760 0 4649 9 0 9 9 0 8 1 bufpl 272 2553 0 88 165 0 165 165 0 8 0 anonpl 24 95764 0 92815 36 0 36 36 0 187 14 amapchunkpl 152 9732 0 9328 33 0 33 33 0 158 14 amappl16 200 1614 0 1601 5 0 5 5 0 8 3 amappl15 192 6 0 6 1 0 1 1 0 8 1 amappl14 184 426 0 423 1 0 1 1 0 8 0 amappl13 176 140 0 130 1 0 1 1 0 8 0 amappl12 168 711 0 687 2 0 2 2 0 8 0 amappl11 160 88 0 87 1 0 1 1 0 8 0 amappl10 152 65 0 57 1 0 1 1 0 8 0 amappl9 144 286 0 285 1 0 1 1 0 8 0 amappl8 136 99 0 96 1 0 1 1 0 8 0 amappl7 128 140 0 129 1 0 1 1 0 8 0 amappl6 120 141 0 138 1 0 1 1 0 8 0 amappl5 112 136 0 128 1 0 1 1 0 8 0 amappl4 104 274 0 257 1 0 1 1 0 8 0 amappl3 96 1755 0 1662 4 0 4 4 0 8 1 amappl2 88 439 0 391 2 0 2 2 0 8 0 amappl1 80 10187 0 9644 13 0 13 13 0 8 1 amappl 88 2660 0 2515 4 0 4 4 0 92 0 uvmvnodes 80 99 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 2 0 0 1 0 1 1 0 8 0 uaddrrnd 24 469 0 442 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 469 0 442 1 0 1 1 0 8 0 vmmpekpl 168 5643 0 5600 3 0 3 3 0 8 0 vmmpepl 168 39677 0 38096 81 0 81 81 0 357 4 vmsppl 368 468 0 442 4 0 4 4 0 8 1 rwobjpl 40 14531 0 13599 11 0 11 11 0 8 1 pdppl 4096 944 0 884 90 22 68 80 0 8 8 pvpl 32 226767 0 219047 96 0 96 96 0 265 24 pmappl 216 468 0 442 3 0 3 3 0 8 0 extentpl 40 46 0 28 1 0 1 1 0 8 0 phpool 112 520 0 22 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(ffffffff834adf53) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834f0459,ffffffff8342614c,13f,ffffffff8342f7be) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff8000015ea000) at tun_clone_destroy+0x32d if_clone_destroy(ffff80003c8cfb40) at if_clone_destroy+0x1d5 sys/net/if.c:1464 sys_ioctl(ffff80002a7c6fb8,ffff80003c8cfd10,ffff80003c8cfc60) at sys_ioctl+0x660 sys/kern/sys_generic.c:-1 syscall(ffff80003c8cfd10) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff80003c8cfd10) at syscall+0x962 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x77dead2842a0, 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(ffffffff834adf53) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834f0459,ffffffff8342614c,13f,ffffffff8342f7be) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff8000015ea000) at tun_clone_destroy+0x32d if_clone_destroy(ffff80003c8cfb40) at if_clone_destroy+0x1d5 sys/net/if.c:1464 sys_ioctl(ffff80002a7c6fb8,ffff80003c8cfd10,ffff80003c8cfc60) at sys_ioctl+0x660 sys/kern/sys_generic.c:-1 syscall(ffff80003c8cfd10) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff80003c8cfd10) at syscall+0x962 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x77dead2842a0, count: -8