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 *411136 66550 0 0x2 0 0 ifconfig db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:438 panic(ffffffff834b7c14) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834f7177,ffffffff8342b6d0,13f,ffffffff834352ee) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff8000015c8800) at tun_clone_destroy+0x32d if_clone_destroy(ffff80002a7e7d00) at if_clone_destroy+0x1d5 sys/net/if.c:1464 sys_ioctl(ffff80003c8f1248,ffff80002a7e7ed0,ffff80002a7e7e20) at sys_ioctl+0x660 sys/kern/sys_generic.c:-1 syscall(ffff80002a7e7ed0) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff80002a7e7ed0) at syscall+0x962 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x76f316262620, 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(ffffffff834b7c14) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834f7177,ffffffff8342b6d0,13f,ffffffff834352ee) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff8000015c8800) at tun_clone_destroy+0x32d if_clone_destroy(ffff80002a7e7d00) at if_clone_destroy+0x1d5 sys/net/if.c:1464 sys_ioctl(ffff80003c8f1248,ffff80002a7e7ed0,ffff80002a7e7e20) at sys_ioctl+0x660 sys/kern/sys_generic.c:-1 syscall(ffff80002a7e7ed0) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff80002a7e7ed0) at syscall+0x962 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x76f316262620, count: -8 ddb> show registers rdi 0 rsi 0x1 rbp 0xffff80002a7e7b90 rbx 0 rdx 0 rcx 0 rax 0xffff80003c8f1248 r8 0x101010101010101 r9 0x8080808080808080 r10 0x3f948c7810a107b0 r11 0x980b892b0d9c1d1b r12 0 r13 0xffffffff838be9c0 tap_cloner r14 0 r15 0x1 rip 0xffffffff82988795 db_enter+0x25 cs 0x8 rflags 0x246 rsp 0xffff80002a7e7b80 ss 0x10 db_enter+0x25: addq $0x8,%rsp ddb> show proc PROC (ifconfig) tid=411136 pid=66550 tcnt=1 stat=onproc flags process=2 proc=0 runpri=32, usrpri=75, slppri=32, nice=20 wchan=0x0, wmesg=, ps_single=0x0 scnt=0 ecnt=0 forw=0xffffffffffffffff, list=0xffff80002a784548,0xffff80003c8f0fc0 process=0xffff800038cc8018 user=0xffff80002a7e2000, vmspace=0xfffff7806cf69e78 estcpu=25, cpticks=1, pctcpu=0.0, user=0, sys=1, intr=0 ddb> ps PID TID PPID UID S PRLAGS PFLAGS WAIT COMMAND 49674 108584 3640 0 3 0x2 0 clonelk ifconfig *66550 411136 35939 0 7 0x2 0 ifconfig 3640 450015 52413 0 3 0x100002 0x88 sigsusp sh 52413 437019 3923 0 3 0x2 0x80 wait syz-executor 35939 356507 271 0 3 0x100002 0x88 sigsusp sh 271 389220 3923 0 3 0x2 0x80 wait syz-executor 73785 439551 3923 0 3 0x2 0 clonelk syz-executor 28126 195133 3923 0 3 0x2 0x80 piperd syz-executor 15804 195090 3923 0 3 0x2 0x80 piperd syz-executor 64906 521560 3923 0 3 0x2 0x80 piperd syz-executor 3923 254108 96595 0 3 0x2 0x80 nanoslp syz-executor 96595 272956 97361 0 3 0x100002 0x88 sigsusp ksh 97361 161389 69150 0 3 0x10 0x88 kqread sshd-session 69150 365269 31305 0 3 0x12 0x80 kqread sshd-session 88860 379834 1 0 3 0x100003 0x80 ttyin getty 31305 334859 1 0 3 0 0x88 kqread sshd 65520 480279 92544 73 3 0x1100010 0x80 kqread syslogd 92544 214391 1 0 3 0x100002 0x80 sbwait syslogd-parent 35661 310308 1 0 3 0x100000 0x80 kqread resolvd 80813 243541 74532 77 2 0x100012 0 dhcpleased 11265 44526 74532 77 3 0x100012 0x80 kqread dhcpleased 74532 196699 1 0 3 0 0x80 kqread dhcpleased 67330 334012 0 0 3 0x14000 0x200 bored smr 540 410130 0 0 3 0x14000 0x200 pgzero zerothread 5428 500787 0 0 3 0x14000 0x200 aiodoned aiodoned 32154 171197 0 0 3 0x14000 0x200 syncer update 56929 181501 0 0 3 0x14000 0x200 cleaner cleaner 268 269217 0 0 3 0x14000 0x200 reaper reaper 59407 73006 0 0 3 0x14000 0x200 pgdaemon pagedaemon 14301 478976 0 0 3 0x14000 0x200 bored viomb 15741 200353 0 0 3 0x14000 0x40000200 acpi0 acpi0 72972 158942 0 0 3 0x14000 0x200 bored softnet0 78514 117208 0 0 3 0x14000 0x200 smrbar systqmp 31508 443270 0 0 3 0x14000 0x200 bored systq 32968 131085 0 0 2 0x14000 0x40000200 softclock 4804 37843 0 0 3 0x14000 0x40000200 idle0 1 28811 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 11017 12093K 12227K 166960K 12271 0 pcb 17 12K 12K 166960K 34 0 rtable 120 4K 9K 166960K 782 0 pf 22 11K 17K 166960K 77 0 ifaddr 25 4K 7K 166960K 108 0 ifgroup 34 1K 2K 166960K 126 0 sysctl 1 1K 9K 166960K 5 0 counters 29 17K 18K 166960K 53 0 ioctlops 0 0K 4K 166960K 74 0 iov 0 0K 24K 166960K 6 0 mount 1 1K 1K 166960K 1 0 log 0 0K 0K 166960K 4 0 vnodes 1296 82K 82K 166960K 1659 0 UFS quota 1 32K 32K 166960K 1 0 UFS mount 5 36K 36K 166960K 5 0 shm 2 1K 5K 166960K 7 0 VM map 2 1K 1K 166960K 2 0 sem 9 0K 0K 166960K 11 0 dirhash 12 2K 2K 166960K 12 0 ACPI 1692 195K 286K 166960K 12472 0 file desc 13 45K 81K 166960K 476 0 sigio 0 0K 0K 166960K 1 0 proc 74 75K 83K 166960K 924 0 subproc 63 3K 4K 166960K 236 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 253 0 ether_multi 1 0K 0K 166960K 1 0 mrt 0 0K 0K 166960K 9 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 576 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 162 150K 177K 166960K 5218 0 UVM aobj 6 2K 2K 166960K 6 0 pinsyscall 34 68K 88K 166960K 1960 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 9 0K 1K 166960K 75 0 temp 33 9117K 9182K 166960K 12509 0 kqueue 13 20K 28K 166960K 49 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 69 0 66 1 0 1 1 0 8 0 rtentry 136 268 0 212 4 0 4 4 0 8 0 unpcb 144 94 0 79 1 0 1 1 0 8 0 syncache 336 5 0 5 1 0 1 1 0 8 1 tcpcb 736 42 0 38 1 0 1 1 0 8 0 arp 96 46 0 38 1 0 1 1 0 8 0 inpcb 328 202 0 192 2 0 2 2 0 8 1 ip6q 80 4 0 2 1 0 1 1 0 8 0 ip6af 40 6 0 4 1 0 1 1 0 8 0 nd6 112 69 0 59 1 0 1 1 0 8 0 pkpcb 40 2 0 2 1 0 1 1 0 8 1 kcovpl 48 26 0 19 1 0 1 1 0 8 0 ppxss 1072 3 0 3 1 0 1 1 0 8 1 pfrktable 1344 4 0 4 1 0 1 1 0 8 1 pfanchor 1288 1 0 1 1 0 1 1 0 8 1 pftag 88 2 0 2 1 0 1 1 0 8 1 pfrule 1360 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 1085 0 803 32 0 32 32 0 8 8 art_table 40 1086 0 803 6 0 6 6 0 8 1 art_node 32 268 0 207 1 0 1 1 0 8 0 semupl 112 1 0 1 1 0 1 1 0 8 1 semapl 72 9 0 2 1 0 1 1 0 8 0 shmpl 120 3 0 0 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 1840 0 342 94 0 94 94 0 8 0 ffsino 256 1840 0 342 94 0 94 94 0 8 0 nchpl 144 2180 0 413 66 0 66 66 0 8 0 vnodes 216 2143 0 0 120 0 120 120 0 8 0 namei 1024 9063 0 9063 2 0 2 2 0 8 2 pfiaddrpl 120 1 0 1 1 0 1 1 0 8 1 kstatmem 264 63 0 48 2 0 2 2 0 8 0 scxspl 216 13583 0 13583 8 0 8 8 1 8 8 plimitpl 152 68 0 53 1 0 1 1 0 8 0 sigapl 424 730 0 692 6 0 6 6 0 8 1 knotepl 120 7485 0 7438 10 0 10 10 0 8 8 kqueuepl 184 61 0 52 1 0 1 1 0 8 0 pipepl 304 190 0 163 3 0 3 3 0 8 0 fdescpl 448 717 0 692 4 0 4 4 0 8 0 filepl 120 2714 0 2526 10 0 10 10 0 8 3 lockfpl 104 58 0 56 1 0 1 1 0 8 0 lockfspl 48 24 0 22 1 0 1 1 0 8 0 sessionpl 144 43 0 35 1 0 1 1 0 8 0 pgrppl 48 70 0 55 1 0 1 1 0 8 0 ucredpl 104 267 0 256 1 0 1 1 0 8 0 zombiepl 144 693 0 692 1 0 1 1 0 8 0 processpl 1160 730 0 692 4 0 4 4 0 8 0 procpl 664 947 0 909 6 0 6 6 0 8 1 sosppl 176 1 0 1 1 0 1 1 0 8 1 sockpl 552 373 0 345 3 0 3 3 0 8 0 mcl64k 65536 5 0 5 1 0 1 1 0 8 1 mcl9k128 9344 1 0 1 1 0 1 1 0 8 1 mcl8k 8192 14 0 14 1 0 1 1 0 8 1 mcl4k 4096 2686 0 2631 14 0 14 14 0 8 6 mcl2k 2048 479 0 476 3 0 3 3 0 8 2 mextrefs 64 123 0 122 1 0 1 1 0 8 0 mtagpl 96 4 0 4 1 0 1 1 0 8 1 mbufpl 256 6802 0 6676 22 1 21 22 0 8 8 bufpl 272 5602 0 89 368 0 368 368 0 8 0 anonpl 24 113920 0 111250 43 0 43 43 0 187 10 amapchunkpl 152 14684 0 14419 26 0 26 26 0 158 13 amappl16 200 1897 0 1887 14 0 14 14 0 8 11 amappl15 192 15 0 15 1 0 1 1 0 8 1 amappl14 184 621 0 618 1 0 1 1 0 8 0 amappl13 176 140 0 130 1 0 1 1 0 8 0 amappl12 168 1007 0 985 2 0 2 2 0 8 0 amappl11 160 70 0 70 1 0 1 1 0 8 1 amappl10 152 58 0 50 1 0 1 1 0 8 0 amappl9 144 291 0 290 1 0 1 1 0 8 0 amappl8 136 149 0 146 1 0 1 1 0 8 0 amappl7 128 166 0 156 1 0 1 1 0 8 0 amappl6 120 200 0 197 1 0 1 1 0 8 0 amappl5 112 198 0 190 1 0 1 1 0 8 0 amappl4 104 302 0 289 1 0 1 1 0 8 0 amappl3 96 2860 0 2790 3 0 3 3 0 8 0 amappl2 88 507 0 458 2 0 2 2 0 8 0 amappl1 80 12162 0 11636 13 0 13 13 0 8 1 amappl 88 4274 0 4176 4 0 4 4 0 92 1 uvmvnodes 80 103 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 0 1 0 1 1 0 8 0 uaddrrnd 24 717 0 692 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 717 0 692 1 0 1 1 0 8 0 vmmpekpl 168 7333 0 7286 3 0 3 3 0 8 0 vmmpepl 168 54982 0 53580 86 0 86 86 0 357 12 vmsppl 368 716 0 692 4 0 4 4 0 8 1 rwobjpl 40 18354 0 17486 12 0 12 12 0 8 0 pdppl 4096 1440 0 1384 90 24 66 74 0 8 10 pvpl 32 304763 0 297937 100 0 100 100 0 265 17 pmappl 216 716 0 692 2 0 2 2 0 8 0 extentpl 40 45 0 27 1 0 1 1 0 8 0 phpool 112 739 0 25 21 0 21 21 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(ffffffff834b7c14) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834f7177,ffffffff8342b6d0,13f,ffffffff834352ee) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff8000015c8800) at tun_clone_destroy+0x32d if_clone_destroy(ffff80002a7e7d00) at if_clone_destroy+0x1d5 sys/net/if.c:1464 sys_ioctl(ffff80003c8f1248,ffff80002a7e7ed0,ffff80002a7e7e20) at sys_ioctl+0x660 sys/kern/sys_generic.c:-1 syscall(ffff80002a7e7ed0) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff80002a7e7ed0) at syscall+0x962 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x76f316262620, 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(ffffffff834b7c14) at panic+0x1cf sys/kern/subr_prf.c:198 __assert(ffffffff834f7177,ffffffff8342b6d0,13f,ffffffff834352ee) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff8000015c8800) at tun_clone_destroy+0x32d if_clone_destroy(ffff80002a7e7d00) at if_clone_destroy+0x1d5 sys/net/if.c:1464 sys_ioctl(ffff80003c8f1248,ffff80002a7e7ed0,ffff80002a7e7e20) at sys_ioctl+0x660 sys/kern/sys_generic.c:-1 syscall(ffff80002a7e7ed0) at syscall+0x962 mi_syscall sys/sys/syscall_mi.h:-1 [inline] syscall(ffff80002a7e7ed0) at syscall+0x962 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x76f316262620, count: -8