panic: kernel diagnostic assertion "sc->sc_dev == 0" failed: file "/syzkaller/managers/main/kernel/sys/net/if_tun.c", line 315 Stopped at db_enter+0x1c: addq $0x8,%rsp TID PID UID PRFLAGS PFLAGS CPU COMMAND *108143 15482 0 0 0x4000000 0 syz-executor.6 db_enter() at db_enter+0x1c sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82772052) at panic+0x165 sys/kern/subr_prf.c:198 __assert(ffffffff827ec355,ffffffff82821483,13b,ffffffff82801149) at __assert+0x29 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000ce4000) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff800026599210) at if_clone_destroy+0x132 sys/net/if.c:1318 sys_ioctl(ffff8000217045a0,ffff800026599320,ffff800026599370) at sys_ioctl+0x49e syscall(ffff8000265993f0) at syscall+0x4a8 sys/arch/amd64/amd64/trap.c:632 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x28882cfbc60, 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 315 ddb> trace db_enter() at db_enter+0x1c sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82772052) at panic+0x165 sys/kern/subr_prf.c:198 __assert(ffffffff827ec355,ffffffff82821483,13b,ffffffff82801149) at __assert+0x29 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000ce4000) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff800026599210) at if_clone_destroy+0x132 sys/net/if.c:1318 sys_ioctl(ffff8000217045a0,ffff800026599320,ffff800026599370) at sys_ioctl+0x49e syscall(ffff8000265993f0) at syscall+0x4a8 sys/arch/amd64/amd64/trap.c:632 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x28882cfbc60, count: -8 ddb> show registers rdi 0 rsi 0x1 rbp 0xffff8000265990a0 rbx 0x80206979 __kernel_virt_to_phys+0x206979 rdx 0xffff800000cf82c0 rcx 0 rax 0xffff8000217045a0 r8 0 r9 0x8080808080808080 r10 0x9a0e6da687fead08 r11 0x313c0b97252ad03 r12 0 r13 0 r14 0 r15 0x1 rip 0xffffffff8133478c db_enter+0x1c cs 0x8 rflags 0x246 rsp 0xffff800026599090 ss 0x10 db_enter+0x1c: addq $0x8,%rsp ddb> show proc PROC (syz-executor.6) pid=108143 stat=onproc flags process=0 proc=4000000 pri=83, usrpri=83, nice=20 forw=0xffffffffffffffff, list=0xffff8000ffff42c8,0xffff80002656cba0 process=0xffff800027fb4000 user=0xffff800026594000, vmspace=0xfffffd8069d6c180 estcpu=33, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb> ps PID TID PPID UID S FLAGS WAIT COMMAND 42620 83197 71787 0 2 0 syz-executor.4 42620 412074 71787 0 3 0x4000080 fsleep syz-executor.4 42620 121792 71787 0 3 0x4000080 fsleep syz-executor.4 15482 474441 11427 0 3 0x80 fsleep syz-executor.6 *15482 108143 11427 0 7 0x4000000 syz-executor.6 85413 50306 92639 0 2 0 syz-executor.3 85413 110653 92639 0 3 0x4000080 lockf syz-executor.3 53128 166011 38054 0 2 0x480 syz-executor.5 53128 226182 38054 0 3 0x4000080 fsleep syz-executor.5 53128 83713 38054 0 3 0x4000080 fsleep syz-executor.5 53128 217773 38054 0 3 0x4000080 fsleep syz-executor.5 71787 281183 48697 0 2 0x482 syz-executor.4 54530 214766 48697 0 2 0x482 syz-executor.7 81864 218353 48697 0 2 0x482 syz-executor.2 96339 180486 48697 0 2 0x482 syz-executor.1 43226 439174 0 0 3 0x14200 acct acct 92639 44361 48697 0 2 0x482 syz-executor.3 11427 349052 48697 0 2 0x482 syz-executor.6 22772 243349 0 0 3 0x14280 nfsidl nfsio 52232 17692 0 0 3 0x14280 nfsidl nfsio 72217 187361 0 0 3 0x14280 nfsidl nfsio 93228 99238 0 0 3 0x14280 nfsidl nfsio 74458 224009 0 0 3 0x14280 nfsidl nfsio 64125 210821 0 0 3 0x14280 nfsidl nfsio 60709 124167 0 0 3 0x14280 nfsidl nfsio 65347 409834 0 0 3 0x14280 nfsidl nfsio 20883 399653 0 0 3 0x14280 nfsidl nfsio 3195 117729 0 0 3 0x14280 nfsidl nfsio 4863 168260 0 0 3 0x14280 nfsidl nfsio 52741 364381 0 0 3 0x14280 nfsidl nfsio 58048 245167 0 0 3 0x14280 nfsidl nfsio 64989 59358 0 0 3 0x14280 nfsidl nfsio 33804 266401 0 0 3 0x14280 nfsidl nfsio 24906 203447 0 0 3 0x14280 nfsidl nfsio 46900 411900 0 0 3 0x14280 nfsidl nfsio 90169 5454 0 0 3 0x14280 nfsidl nfsio 99804 385159 0 0 3 0x14280 nfsidl nfsio 25748 430779 0 0 3 0x14280 nfsidl nfsio 33986 421451 48697 0 2 0x482 syz-executor.0 38054 271714 48697 0 2 0x482 syz-executor.5 84509 469334 1 0 3 0x100083 ttyin getty 97017 178946 0 0 3 0x14200 bored sosplice 48697 315531 78486 0 3 0x82 thrsleep syz-fuzzer 48697 55302 78486 0 2 0x4000482 syz-fuzzer 48697 239790 78486 0 3 0x4000082 thrsleep syz-fuzzer 48697 352591 78486 0 3 0x4000082 wait syz-fuzzer 48697 85352 78486 0 3 0x4000082 thrsleep syz-fuzzer 48697 114515 78486 0 3 0x4000082 kqread syz-fuzzer 48697 348689 78486 0 3 0x4000082 wait syz-fuzzer 48697 427241 78486 0 3 0x4000082 wait syz-fuzzer 48697 159458 78486 0 3 0x4000082 wait syz-fuzzer 48697 40075 78486 0 3 0x4000082 thrsleep syz-fuzzer 48697 40035 78486 0 3 0x4000082 wait syz-fuzzer 48697 236171 78486 0 3 0x4000082 wait syz-fuzzer 48697 36413 78486 0 3 0x4000082 wait syz-fuzzer 48697 410426 78486 0 3 0x4000082 wait syz-fuzzer 78486 191038 57891 0 3 0x10008a sigsusp ksh 57891 120918 75484 0 3 0x9a kqread sshd 75484 92642 1 0 3 0x88 kqread sshd 28605 440554 83726 73 3 0x1100090 kqread syslogd 83726 131815 1 0 3 0x100082 netio syslogd 46662 427144 1 0 3 0x100080 kqread resolvd 35628 123228 17209 77 2 0x100092 dhcpleased 61349 420026 17209 77 3 0x100092 kqread dhcpleased 17209 386979 1 0 3 0x80 kqread dhcpleased 14535 198963 0 0 3 0x14200 bored smr 51682 87037 0 0 2 0x14200 zerothread 23147 352877 0 0 3 0x14200 aiodoned aiodoned 56050 499074 0 0 3 0x14200 syncer update 40459 401148 0 0 3 0x14200 cleaner cleaner 36350 289173 0 0 3 0x14200 reaper reaper 22221 182532 0 0 3 0x14200 pgdaemon pagedaemon 98212 436334 0 0 3 0x14200 bored viomb 25605 39300 0 0 3 0x40014200 acpi0 acpi0 6707 436934 0 0 3 0x14200 bored softnet3 26649 194454 0 0 3 0x14200 bored softnet2 30568 45068 0 0 3 0x14200 bored softnet1 4714 423005 0 0 3 0x14200 bored softnet0 42898 74965 0 0 3 0x14200 bored systqmp 57172 370149 0 0 3 0x14200 bored systq 70951 486756 0 0 2 0x40014200 softclock 77566 263227 0 0 3 0x40014200 idle0 1 418691 0 0 3 0x80082 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb> show all locks No such command ddb> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 10199 6432K 6897K 78643K 25423 0 pcb 13 24K 26K 78643K 2415 0 rtable 134 9K 12K 78643K 3766 0 ifaddr 64 20K 25K 78643K 1064 0 ifgroup 51 2K 2K 78643K 842 0 sysctl 2 0K 0K 78643K 2 0 counters 27 17K 17K 78643K 535 0 ioctlops 0 0K 4K 78643K 1655 0 iov 0 0K 36K 78643K 2462 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 4 0 vnodes 1591 99K 100K 78643K 11360 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 9K 78643K 179 0 VM map 2 1K 1K 78643K 2 0 sem 22 10K 20K 78643K 838 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 15 53K 77K 78643K 14538 0 sigio 0 0K 0K 78643K 194 0 proc 67 59K 75K 78643K 2339 0 subproc 104 6K 6K 78643K 663 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 1420 0 in_multi 36 2K 7K 78643K 1304 0 ether_multi 1 0K 0K 78643K 263 0 mrt 3 0K 0K 78643K 43 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 223 996K 996K 78643K 223 0 exec 0 0K 1K 78643K 3202 0 pfkey data 0 0K 0K 78643K 8 0 tdb 3 0K 0K 78643K 3 0 pagedep 1 8K 8K 78643K 1 0 inodedep 1 32K 32K 78643K 1 0 newblk 1 0K 0K 78643K 1 0 VM swap 8 62K 64K 78643K 10 0 UVM amap 444 101K 105K 78643K 135464 0 UVM aobj 45 2K 2K 78643K 48 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 577 0 NDP 13 0K 1K 78643K 377 0 temp 74 5856K 14052K 78643K 103456 0 kqueue 12 18K 28K 78643K 1247 0 SYN cache 2 16K 16K 78643K 2 0 ddb> show all pools Name Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle rtpcb 120 1236 0 1233 15 13 2 3 0 8 1 rtentry 112 1286 0 1234 4 1 3 4 0 8 0 unpcb 144 24029 0 24016 171 170 1 11 0 8 0 syncache 296 13 0 13 2 2 0 1 0 8 0 sackhl 24 2 0 2 2 2 0 1 0 8 0 tcpqe 32 155 0 155 3 3 0 1 0 8 0 tcpcb 776 17064 0 17058 280 271 9 18 0 8 8 arp 88 185 0 177 1 0 1 1 0 8 0 ipq 40 15 0 15 7 7 0 1 0 8 0 ipqe 40 47 0 47 7 7 0 1 0 8 0 inpcb 336 27415 0 27405 292 283 9 18 0 8 8 ip6q 72 3 0 3 1 1 0 1 0 8 0 ip6af 40 6 0 6 1 1 0 1 0 8 0 nd6 104 209 0 199 1 0 1 1 0 8 0 pkpcb 40 144 0 144 13 13 0 1 0 8 0 kcovpl 48 51 0 43 1 0 1 1 0 8 0 mppekey 1024 106 0 106 4 4 0 1 0 8 0 ppxss 1160 377 0 376 26 25 1 1 0 8 0 pppxif 1360 162 0 161 15 14 1 1 0 8 0 pfstscr 40 63 0 57 2 1 1 1 0 8 0 pfosfp 40 10 0 9 1 0 1 1 0 8 0 pfosfpen 112 10 0 9 1 0 1 1 0 8 0 pfanchor 1288 643 31 131 43 0 43 43 0 8 0 pfqueue 264 41 0 41 3 3 0 1 0 8 0 pfstitem 24 7 0 0 1 0 1 1 0 8 0 pfstkey 128 132 0 128 3 2 1 1 0 8 0 pfstate 352 68 0 63 3 2 1 1 0 8 0 art_heap8 4096 2 0 1 2 1 1 2 0 8 0 art_heap4 256 5591 0 5392 39 19 20 29 0 8 1 art_table 32 5593 0 5393 5 1 4 4 0 8 1 art_node 16 1272 0 1229 1 0 1 1 0 8 0 sysvmsgpl 40 62 0 22 1 0 1 1 0 8 0 semapl 112 832 0 812 1 0 1 1 0 8 0 shmpl 112 45 0 3 2 0 2 2 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 21556 0 20091 92 0 92 92 0 8 0 ffsino 240 21556 0 20091 87 0 87 87 0 8 0 nchpl 144 41666 0 41111 63 41 22 63 0 8 0 rtmask 32 3 0 3 1 1 0 1 0 8 0 uvmvnodes 80 5926 0 0 121 0 121 121 0 8 0 vnodes 216 5926 0 0 330 0 330 330 0 8 0 namei 1024 154991 0 154991 11 10 1 3 0 8 1 kstatmem 264 456 0 434 11 9 2 3 0 8 0 scsiplug 72 8 0 8 3 3 0 1 0 8 0 scxspl 216 124851 0 124851 36 35 1 8 0 8 1 plimitpl 152 3320 0 3305 1 0 1 1 0 8 0 sigapl 424 14811 0 14744 11 3 8 8 0 8 0 futexpl 64 157338 0 157332 3 2 1 1 0 8 0 knotepl 120 284512 0 284432 174 168 6 19 0 8 0 kqueuepl 184 3140 0 3132 47 46 1 6 0 8 0 pipepl 288 3230 0 3201 53 50 3 9 0 8 0 fdescpl 432 14732 0 14706 4 0 4 4 0 8 0 filepl 120 132609 0 132366 178 165 13 20 0 8 5 lockfpl 104 4247 0 4242 6 5 1 2 0 8 0 lockfspl 48 1192 0 1188 1 0 1 1 0 8 0 sessionpl 144 67 0 51 1 0 1 1 0 8 0 pgrppl 48 126 0 110 1 0 1 1 0 8 0 ucredpl 104 17477 0 17467 1 0 1 1 0 8 0 zombiepl 144 14748 0 14744 2 1 1 1 0 8 0 processpl 1008 14811 0 14744 16 7 9 9 0 8 0 procpl 696 36306 0 36219 25 16 9 10 0 8 0 sosppl 168 115 0 115 21 21 0 1 0 8 0 sockpl 456 52828 0 52802 1235 1224 11 44 0 8 7 mcl64k 65536 1122 0 1122 22 21 1 1 0 8 1 mcl16k 16384 320 0 320 41 40 1 1 0 8 1 mcl12k 12288 542 0 542 31 30 1 1 0 8 1 mcl9k 9216 273 0 273 34 33 1 1 0 8 1 mcl8k 8192 1711 0 1711 28 27 1 1 0 8 1 mcl4k 4096 1806 0 1806 17 16 1 1 0 8 1 mcl2k2 2112 112 0 112 33 33 0 1 0 8 0 mcl2k 2048 106632 0 106593 67 60 7 31 0 8 1 mtagpl 96 1720 0 1574 18 12 6 11 0 8 1 mbufpl 256 332536 0 332269 920 889 31 124 0 8 6 bufpl 288 28325 0 21940 457 0 457 457 0 8 0 anonpl 24 1476599 0 1463465 276 165 111 172 0 188 0 amapchunkpl 152 431670 0 430775 193 154 39 68 0 158 2 amappl16 200 28843 0 28347 143 115 28 42 0 8 0 amappl15 192 15 0 14 1 0 1 1 0 8 0 amappl14 184 283 0 270 2 1 1 2 0 8 0 amappl13 176 7 0 7 1 1 0 1 0 8 0 amappl12 168 16015 0 15986 2 0 2 2 0 8 0 amappl11 160 52 0 42 1 0 1 1 0 8 0 amappl10 152 167 0 156 2 1 1 1 0 8 0 amappl9 144 296 0 296 22 22 0 2 0 8 0 amappl8 136 739 0 608 5 0 5 5 0 8 0 amappl7 128 149 0 130 1 0 1 1 0 8 0 amappl6 120 642 0 623 2 1 1 2 0 8 0 amappl5 112 1051 0 1043 1 0 1 1 0 8 0 amappl4 104 1292 0 1253 4 2 2 2 0 8 0 amappl3 96 84468 0 84385 3 0 3 3 0 8 0 amappl2 88 15373 0 15309 4 2 2 3 0 8 0 amappl1 80 63703 0 63203 22 11 11 22 0 8 0 amappl 88 133678 0 133427 8 1 7 7 0 92 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 47 0 3 1 0 1 1 0 8 0 uaddrrnd 24 14732 0 14706 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 14732 0 14706 1 0 1 1 0 8 0 vmmpekpl 168 105535 0 105471 4 0 4 4 0 8 0 vmmpepl 168 882750 0 880399 323 196 127 130 0 357 3 vmsppl 368 14731 0 14706 3 0 3 3 0 8 0 rwobjpl 24 206527 0 198972 48 0 48 48 0 8 0 pdppl 4096 29470 0 29412 846 782 64 70 0 8 6 pvpl 32 4072008 0 4053233 628 438 190 334 0 265 0 pmappl 216 14731 0 14706 2 0 2 2 0 8 0 extentpl 40 56 0 38 1 0 1 1 0 8 0 phpool 112 3002 0 2218 26 0 26 26 0 8 0 ddb> machine ddbcpu 0 No such command ddb> trace db_enter() at db_enter+0x1c sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82772052) at panic+0x165 sys/kern/subr_prf.c:198 __assert(ffffffff827ec355,ffffffff82821483,13b,ffffffff82801149) at __assert+0x29 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000ce4000) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff800026599210) at if_clone_destroy+0x132 sys/net/if.c:1318 sys_ioctl(ffff8000217045a0,ffff800026599320,ffff800026599370) at sys_ioctl+0x49e syscall(ffff8000265993f0) at syscall+0x4a8 sys/arch/amd64/amd64/trap.c:632 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x28882cfbc60, count: -8 ddb> machine ddbcpu 1 No such command ddb> trace db_enter() at db_enter+0x1c sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82772052) at panic+0x165 sys/kern/subr_prf.c:198 __assert(ffffffff827ec355,ffffffff82821483,13b,ffffffff82801149) at __assert+0x29 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000ce4000) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff800026599210) at if_clone_destroy+0x132 sys/net/if.c:1318 sys_ioctl(ffff8000217045a0,ffff800026599320,ffff800026599370) at sys_ioctl+0x49e syscall(ffff8000265993f0) at syscall+0x4a8 sys/arch/amd64/amd64/trap.c:632 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x28882cfbc60, count: -8