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 *424052 74737 0 0x2 0 0 ifconfig db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:438 panic(ffffffff834c1c56) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834fdfa3,ffffffff83437931,13f,ffffffff8344158c) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff800001613000) at tun_clone_destroy+0x32d if_clone_destroy(ffff800038cc6e40) at if_clone_destroy+0x1d5 sys/net/if.c:1464 sys_ioctl(ffff80002a785a08,ffff800038cc7010,ffff800038cc6f60) at sys_ioctl+0x660 sys/kern/sys_generic.c:-1 syscall(ffff800038cc7010) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff800038cc7010) at syscall+0x962 sys/arch/amd64/amd64/trap.c:804 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x72a8fb465ed0, 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(ffffffff834c1c56) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834fdfa3,ffffffff83437931,13f,ffffffff8344158c) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff800001613000) at tun_clone_destroy+0x32d if_clone_destroy(ffff800038cc6e40) at if_clone_destroy+0x1d5 sys/net/if.c:1464 sys_ioctl(ffff80002a785a08,ffff800038cc7010,ffff800038cc6f60) at sys_ioctl+0x660 sys/kern/sys_generic.c:-1 syscall(ffff800038cc7010) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff800038cc7010) at syscall+0x962 sys/arch/amd64/amd64/trap.c:804 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x72a8fb465ed0, count: -8 ddb> show registers rdi 0 rsi 0x1 rbp 0xffff800038cc6cd0 rbx 0 rdx 0 rcx 0 rax 0xffff80002a785a08 r8 0x101010101010101 r9 0x8080808080808080 r10 0xb09282446fee2cda r11 0xb948d256096e4b6b r12 0 r13 0xffffffff83940900 tap_cloner r14 0 r15 0x1 rip 0xffffffff827d6da5 db_enter+0x25 cs 0x8 rflags 0x246 rsp 0xffff800038cc6cc0 ss 0x10 db_enter+0x25: addq $0x8,%rsp ddb> show proc PROC (ifconfig) tid=424052 pid=74737 tcnt=1 stat=onproc flags process=2 proc=0 runpri=32, usrpri=73, slppri=32, nice=20 wchan=0x0, wmesg=, ps_single=0x0 scnt=0 ecnt=0 forw=0xffffffffffffffff, list=0xffff80002a7c5cb0,0xffff80002a7842c0 process=0xffff800038cc9238 user=0xffff800038cc2000, vmspace=0xfffff5807f22b5c0 estcpu=23, cpticks=2, pctcpu=0.0, user=1, sys=1, intr=0 ddb> ps PID TID PPID UID S PRLAGS PFLAGS WAIT COMMAND 25610 442402 27405 0 3 0x2 0 clonelk ifconfig 27405 336540 10208 0 3 0x100002 0x88 sigsusp sh 10208 346403 85042 0 3 0x2 0x80 wait syz-executor *74737 424052 14206 0 7 0x2 0 ifconfig 14206 456870 506 0 3 0x100002 0x88 sigsusp sh 506 83568 85042 0 3 0x2 0x80 wait syz-executor 26580 171204 85042 0 3 0x2 0x80 piperd syz-executor 60358 95146 85042 0 3 0x2 0x80 piperd syz-executor 85042 426844 31650 0 3 0x2 0x80 wait syz-executor 31650 413404 34493 0 3 0x100002 0x88 sigsusp ksh 34493 59155 72697 0 3 0x10 0x88 kqread sshd-session 72697 163622 49673 0 3 0x12 0x80 kqread sshd-session 19139 433250 1 0 3 0x100003 0x80 ttyin getty 49673 204804 1 0 3 0 0x88 kqread sshd 49869 185020 6980 73 3 0x1100010 0x80 kqread syslogd 6980 415044 1 0 3 0x100002 0x80 sbwait syslogd-parent 98864 113188 1 0 3 0x100000 0x80 kqread resolvd 47469 332281 72241 77 2 0x100012 0 dhcpleased 3331 213927 72241 77 3 0x100012 0x80 kqread dhcpleased 72241 124822 1 0 3 0 0x80 kqread dhcpleased 95123 26281 0 0 3 0x14000 0x200 bored smr 88778 363345 0 0 3 0x14000 0x200 pgzero zerothread 93751 382185 0 0 3 0x14000 0x200 aiodoned aiodoned 97913 422023 0 0 3 0x14000 0x200 syncer update 70800 298100 0 0 3 0x14000 0x200 cleaner cleaner 18335 285641 0 0 3 0x14000 0x200 reaper reaper 54913 433396 0 0 3 0x14000 0x200 pgdaemon pagedaemon 12009 433181 0 0 3 0x14000 0x200 bored viomb 13092 486534 0 0 3 0x14000 0x40000200 acpi0 acpi0 89241 517250 0 0 3 0x14000 0x200 bored softnet0 98750 521500 0 0 3 0x14000 0x200 smrbar systqmp 14984 28914 0 0 3 0x14000 0x200 bored systq 54342 412312 0 0 3 0x14000 0x40000200 tmoslp softclock 7331 433675 0 0 3 0x14000 0x40000200 idle0 1 179584 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 11020 12103K 12736K 166960K 12493 0 pcb 17 12K 12K 166960K 52 0 rtable 127 5K 7K 166960K 1504 0 pf 23 11K 18K 166960K 191 0 ifaddr 23 4K 7K 166960K 204 0 ifgroup 34 1K 2K 166960K 214 0 sysctl 2 1K 9K 166960K 7 0 counters 29 17K 17K 166960K 77 0 ioctlops 0 0K 4K 166960K 169 0 iov 0 0K 12K 166960K 4 0 mount 1 1K 1K 166960K 1 0 log 0 0K 0K 166960K 4 0 vnodes 1389 87K 87K 166960K 2200 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 3K 3K 166960K 49 0 dirhash 12 2K 2K 166960K 15 0 ACPI 1692 195K 286K 166960K 12472 0 file desc 12 41K 93K 166960K 900 0 sigio 0 0K 0K 166960K 2 0 proc 74 75K 116K 166960K 1593 0 subproc 54 3K 4K 166960K 441 0 NFS srvsock 1 0K 0K 166960K 1 0 NFS daemon 1 16K 16K 166960K 1 0 ip_moptions 0 0K 0K 166960K 16 0 in_multi 44 2K 6K 166960K 522 0 ether_multi 1 0K 0K 166960K 2 0 mrt 1 0K 0K 166960K 21 0 ISOFS mount 1 32K 32K 166960K 1 0 MSDOSFS mount 1 16K 16K 166960K 1 0 ttys 55 254K 254K 166960K 55 0 exec 0 0K 1K 166960K 883 0 fusefs mount 1 32K 32K 166960K 1 0 pfkey data 0 0K 0K 166960K 1 0 tdb 3 0K 0K 166960K 3 0 VM swap 8 62K 64K 166960K 10 0 UVM amap 156 142K 167K 166960K 7824 0 UVM aobj 7 2K 2K 166960K 8 0 pinsyscall 33 66K 95K 166960K 2994 0 memdesc 1 4K 4K 166960K 1 0 crypto data 1 1K 1K 166960K 1 0 ip6_options 0 0K 0K 166960K 6 0 NDP 7 0K 2K 166960K 145 0 temp 30 9118K 9182K 166960K 13499 0 kqueue 13 20K 28K 166960K 79 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 128 0 125 1 0 1 1 0 8 0 rtentry 136 530 0 474 4 0 4 4 0 8 0 unpcb 144 114 0 99 1 0 1 1 0 8 0 syncache 336 5 0 5 1 0 1 1 0 8 1 tcpcb 736 44 0 40 1 0 1 1 0 8 0 arp 96 95 0 86 1 0 1 1 0 8 0 inpcb 328 620 0 611 7 0 7 7 0 8 6 ip6q 80 6 0 0 1 0 1 1 0 8 0 ip6af 40 6 0 0 1 0 1 1 0 8 0 nd6 112 138 0 129 1 0 1 1 0 8 0 pkpcb 40 1 0 1 1 0 1 1 0 8 1 kcovpl 48 49 0 43 1 0 1 1 0 8 0 ppxss 1072 4 0 4 1 0 1 1 0 8 1 pfosfp 40 2 0 0 1 0 1 1 0 8 0 pfosfpen 112 2 0 0 1 0 1 1 0 8 0 pfrktable 1344 1 0 1 1 0 1 1 0 8 1 pfrule 1360 2 0 1 1 0 1 1 0 8 0 art_heap8 4096 2 0 0 2 0 2 2 0 8 0 art_heap4 256 2139 0 1857 32 2 30 32 0 8 8 art_table 40 2141 0 1857 6 0 6 6 0 8 1 art_node 32 530 0 469 1 0 1 1 0 8 0 sysvmsgpl 40 2 0 1 1 0 1 1 0 8 0 semupl 112 1 0 1 1 0 1 1 0 8 1 semapl 72 47 0 22 1 0 1 1 0 8 0 shmpl 120 5 0 1 1 0 1 1 0 8 0 dirhash 1024 19 0 2 3 0 3 3 0 8 0 dino2pl 256 1999 0 450 97 0 97 97 0 8 0 ffsino 256 1999 0 450 97 0 97 97 0 8 0 nchpl 144 2431 0 601 68 0 68 68 0 8 0 rtmask 32 1 0 1 1 0 1 1 0 8 1 vnodes 216 2820 0 0 157 0 157 157 0 8 0 namei 1024 13452 0 13452 3 0 3 3 0 8 3 kstatmem 264 107 0 92 2 0 2 2 0 8 0 scsiplug 72 1 0 1 1 0 1 1 0 8 1 scxspl 216 7759 0 7759 4 0 4 4 1 8 4 plimitpl 152 96 0 80 1 0 1 1 0 8 0 sigapl 424 1105 0 1066 6 0 6 6 0 8 1 knotepl 120 8400 0 8355 10 0 10 10 0 8 7 kqueuepl 184 234 0 225 4 0 4 4 0 8 3 pipepl 304 258 0 231 3 0 3 3 0 8 0 fdescpl 448 1092 0 1068 5 0 5 5 0 8 1 filepl 120 4341 0 4167 11 0 11 11 0 8 4 lockfpl 104 55 0 53 1 0 1 1 0 8 0 lockfspl 48 23 0 21 1 0 1 1 0 8 0 sessionpl 144 113 0 105 1 0 1 1 0 8 0 pgrppl 48 165 0 149 1 0 1 1 0 8 0 ucredpl 104 379 0 367 1 0 1 1 0 8 0 zombiepl 144 1070 0 1066 1 0 1 1 0 8 0 processpl 1160 1105 0 1066 4 0 4 4 0 8 0 procpl 664 1485 0 1446 6 0 6 6 0 8 0 sockpl 552 877 0 850 7 0 7 7 0 8 4 mcl64k 65536 7 0 7 1 0 1 1 0 8 1 mcl9k128 9344 2 0 2 1 0 1 1 0 8 1 mcl8k 8192 20 0 14 1 0 1 1 0 8 0 mcl4k 4096 2765 0 2711 14 0 14 14 0 8 7 mcl2k 2048 940 0 939 4 0 4 4 0 8 3 mextrefs 64 269 0 268 1 0 1 1 0 8 0 mtagpl 96 4 0 4 1 0 1 1 0 8 1 mbufpl 256 9219 0 9118 18 0 18 18 0 8 7 bufpl 272 2625 0 88 170 0 170 170 0 8 0 anonpl 24 144776 0 142149 30 0 30 30 0 187 10 amapchunkpl 152 21524 0 21274 22 0 22 22 0 158 8 amappl16 200 1876 0 1866 5 0 5 5 0 8 4 amappl15 192 3 0 3 1 0 1 1 0 8 1 amappl14 184 860 0 857 1 0 1 1 0 8 0 amappl13 176 187 0 177 1 0 1 1 0 8 0 amappl12 168 1478 0 1457 2 0 2 2 0 8 0 amappl11 160 7 0 7 1 0 1 1 0 8 1 amappl10 152 59 0 49 1 0 1 1 0 8 0 amappl9 144 283 0 283 1 0 1 1 0 8 1 amappl8 136 245 0 242 1 0 1 1 0 8 0 amappl7 128 215 0 205 1 0 1 1 0 8 0 amappl6 120 344 0 341 1 0 1 1 0 8 0 amappl5 112 283 0 274 1 0 1 1 0 8 0 amappl4 104 384 0 369 1 0 1 1 0 8 0 amappl3 96 4428 0 4362 4 0 4 4 0 8 1 amappl2 88 586 0 537 2 0 2 2 0 8 0 amappl1 80 15711 0 15194 13 0 13 13 0 8 1 amappl 88 6495 0 6401 5 0 5 5 0 92 1 uvmvnodes 80 104 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 254 0 254 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 7 0 1 1 0 1 1 0 8 0 uaddrrnd 24 1092 0 1068 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 1092 0 1068 1 0 1 1 0 8 0 vmmpekpl 168 9841 0 9799 3 0 3 3 0 8 0 vmmpepl 168 78476 0 77112 80 0 80 80 0 357 11 vmsppl 368 1091 0 1068 4 0 4 4 0 8 1 rwobjpl 40 24444 0 23588 11 0 11 11 0 8 1 pdppl 4096 2190 0 2136 102 40 62 80 0 8 8 pvpl 32 410814 0 404126 80 0 80 80 0 265 11 pmappl 216 1091 0 1068 3 0 3 3 0 8 1 extentpl 40 45 0 27 1 0 1 1 0 8 0 phpool 112 559 0 42 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(ffffffff834c1c56) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834fdfa3,ffffffff83437931,13f,ffffffff8344158c) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff800001613000) at tun_clone_destroy+0x32d if_clone_destroy(ffff800038cc6e40) at if_clone_destroy+0x1d5 sys/net/if.c:1464 sys_ioctl(ffff80002a785a08,ffff800038cc7010,ffff800038cc6f60) at sys_ioctl+0x660 sys/kern/sys_generic.c:-1 syscall(ffff800038cc7010) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff800038cc7010) at syscall+0x962 sys/arch/amd64/amd64/trap.c:804 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x72a8fb465ed0, 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(ffffffff834c1c56) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834fdfa3,ffffffff83437931,13f,ffffffff8344158c) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff800001613000) at tun_clone_destroy+0x32d if_clone_destroy(ffff800038cc6e40) at if_clone_destroy+0x1d5 sys/net/if.c:1464 sys_ioctl(ffff80002a785a08,ffff800038cc7010,ffff800038cc6f60) at sys_ioctl+0x660 sys/kern/sys_generic.c:-1 syscall(ffff800038cc7010) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff800038cc7010) at syscall+0x962 sys/arch/amd64/amd64/trap.c:804 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x72a8fb465ed0, count: -8