panic: kernel diagnostic assertion "sc->sc_dev == 0" failed: file "/syzkaller/managers/main/kernel/sys/net/if_tun.c", line 303 Stopped at db_enter+0x18: addq $0x8,%rsp TID PID UID PRFLAGS PFLAGS CPU COMMAND *464013 60152 0 0 0x4000000 0 syz-executor.3 db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82728421) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff827a20ae,ffffffff827d17fa,12f,ffffffff827b21bf) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000e1a000) at tun_clone_destroy+0x234 sys/net/if_tun.c:303 if_clone_destroy(ffff80002e90c3c0) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff8000fffec030,ffff80002e90c4d8,ffff80002e90c520) at sys_ioctl+0x49e syscall(ffff80002e90c5a0) at syscall+0x4e6 sys/arch/amd64/amd64/trap.c:626 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xc6fc06cc190, 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 303 ddb> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82728421) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff827a20ae,ffffffff827d17fa,12f,ffffffff827b21bf) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000e1a000) at tun_clone_destroy+0x234 sys/net/if_tun.c:303 if_clone_destroy(ffff80002e90c3c0) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff8000fffec030,ffff80002e90c4d8,ffff80002e90c520) at sys_ioctl+0x49e syscall(ffff80002e90c5a0) at syscall+0x4e6 sys/arch/amd64/amd64/trap.c:626 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xc6fc06cc190, count: -8 ddb> show registers rdi 0 rsi 0x1 rbp 0xffff80002e90c250 rbx 0x80206979 __kernel_virt_to_phys+0x206979 rdx 0xffff800000d16dc0 rcx 0 rax 0xffff8000fffec030 r8 0 r9 0x8080808080808080 r10 0xb2c3246237bce052 r11 0xca9f5a14da7718e6 r12 0 r13 0 r14 0 r15 0x1 rip 0xffffffff814a7c88 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff80002e90c240 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb> show proc PROC (syz-executor.3) pid=464013 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=84, nice=20 forw=0xffffffffffffffff, list=0xffff8000ffff5060,0xffffffff82c99480 process=0xffff8000fffef7b0 user=0xffff80002e907000, vmspace=0xfffffd806b9e8450 estcpu=36, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb> ps PID TID PPID UID S FLAGS WAIT COMMAND 60152 421883 81853 0 2 0x480 syz-executor.3 *60152 464013 81853 0 7 0x4000000 syz-executor.3 20718 430638 1 0 3 0x100083 ttyin getty 21047 424188 37896 0 3 0x82 piperd syz-executor.5 70754 217321 37896 0 3 0x82 piperd syz-executor.0 64256 371646 37896 0 3 0x82 piperd syz-executor.4 51022 350515 37896 0 3 0x82 piperd syz-executor.7 51288 9515 0 0 3 0x14200 acct acct 7556 348878 37896 0 3 0x82 piperd syz-executor.2 19911 283258 0 0 3 0x14280 nfsidl nfsio 75418 79696 0 0 3 0x14280 nfsidl nfsio 93419 507548 0 0 3 0x14280 nfsidl nfsio 96294 239276 0 0 3 0x14280 nfsidl nfsio 71677 71930 0 0 3 0x14280 nfsidl nfsio 47149 396845 0 0 3 0x14280 nfsidl nfsio 70417 363266 0 0 3 0x14280 nfsidl nfsio 31674 522687 0 0 3 0x14280 nfsidl nfsio 54140 261371 0 0 3 0x14280 nfsidl nfsio 65057 27280 0 0 3 0x14280 nfsidl nfsio 2208 443809 0 0 3 0x14280 nfsidl nfsio 37691 309736 0 0 3 0x14280 nfsidl nfsio 89275 24682 0 0 3 0x14280 nfsidl nfsio 4842 146662 0 0 3 0x14280 nfsidl nfsio 41306 155073 0 0 3 0x14280 nfsidl nfsio 75122 350526 0 0 3 0x14280 nfsidl nfsio 5231 398653 0 0 3 0x14280 nfsidl nfsio 50928 171054 0 0 3 0x14280 nfsidl nfsio 40380 11589 0 0 3 0x14280 nfsidl nfsio 17140 333414 0 0 3 0x14280 nfsidl nfsio 61057 160444 37896 0 2 0x482 syz-executor.6 81853 497950 37896 0 2 0x482 syz-executor.3 46106 9606 0 0 3 0x14200 bored sosplice 37896 132255 42814 0 3 0x82 thrsleep syz-fuzzer 37896 337456 42814 0 2 0x4000482 syz-fuzzer 37896 111393 42814 0 3 0x4000082 wait syz-fuzzer 37896 443989 42814 0 3 0x4000082 wait syz-fuzzer 37896 120264 42814 0 3 0x4000082 thrsleep syz-fuzzer 37896 182225 42814 0 3 0x4000082 thrsleep syz-fuzzer 37896 154065 42814 0 3 0x4000082 wait syz-fuzzer 37896 135013 42814 0 3 0x4000082 thrsleep syz-fuzzer 37896 68073 42814 0 2 0x4000002 syz-fuzzer 37896 137959 42814 0 3 0x4000082 thrsleep syz-fuzzer 37896 321542 42814 0 3 0x4000082 wait syz-fuzzer 37896 156815 42814 0 3 0x4000082 wait syz-fuzzer 37896 1453 42814 0 3 0x4000082 wait syz-fuzzer 37896 465074 42814 0 3 0x4000082 thrsleep syz-fuzzer 37896 396384 42814 0 3 0x4000082 wait syz-fuzzer 42814 335506 26359 0 3 0x10008a sigsusp ksh 26359 343550 86865 0 3 0x9a kqread sshd 86865 171350 1 0 3 0x88 kqread sshd 50275 304392 25935 73 3 0x1100090 kqread syslogd 25935 54881 1 0 3 0x100082 netio syslogd 13074 357992 1 0 3 0x100080 kqread resolvd 51964 203009 88866 77 2 0x100012 dhcpleased 18628 403728 88866 77 3 0x100092 kqread dhcpleased 88866 50575 1 0 3 0x80 kqread dhcpleased 66655 275326 0 0 3 0x14200 bored smr 16084 266708 0 0 2 0x14200 zerothread 93281 156338 0 0 3 0x14200 aiodoned aiodoned 95773 157841 0 0 3 0x14200 syncer update 74222 115843 0 0 3 0x14200 cleaner cleaner 29656 328136 0 0 3 0x14200 reaper reaper 1429 289233 0 0 3 0x14200 pgdaemon pagedaemon 78491 244588 0 0 3 0x14200 bored viomb 49282 87379 0 0 3 0x40014200 acpi0 acpi0 9107 363464 0 0 3 0x14200 bored softnet 16329 332910 0 0 3 0x14200 bored softnet 46696 427270 0 0 3 0x14200 bored softnet 95389 199290 0 0 3 0x14200 bored softnet 71 277280 0 0 3 0x14200 bored systqmp 43423 370877 0 0 3 0x14200 bored systq 23468 150307 0 0 3 0x40014200 bored softclock 51854 309849 0 0 3 0x40014200 idle0 1 523455 0 0 3 0x82 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 10232 6438K 7019K 78643K 39781 0 pcb 13 18K 20K 78643K 3029 0 rtable 169 15K 17K 78643K 4820 0 ifaddr 86 27K 30K 78643K 1875 0 sysctl 3 1K 5K 78643K 47 0 counters 26 17K 17K 78643K 789 0 ioctlops 0 0K 4K 78643K 2040 0 iov 0 0K 36K 78643K 2346 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 4 0 vnodes 1552 97K 98K 78643K 15958 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 9K 78643K 154 0 VM map 2 0K 0K 78643K 2 0 sem 23 3K 5K 78643K 2493 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 10 33K 73K 78643K 18235 0 sigio 0 0K 0K 78643K 394 0 proc 63 59K 83K 78643K 3863 0 subproc 91 5K 10K 78643K 1442 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 988 0 in_multi 65 4K 6K 78643K 1554 0 ether_multi 1 0K 0K 78643K 90 0 mrt 1 0K 0K 78643K 95 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 283 1261K 1261K 78643K 283 0 exec 0 0K 1K 78643K 3663 0 pfkey data 0 0K 0K 78643K 13 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 318 87K 110K 78643K 115549 0 UVM aobj 131 4K 6K 78643K 140 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 1063 0 NDP 12 0K 1K 78643K 626 0 temp 126 5770K 39574K 78643K 173347 0 kqueue 12 18K 28K 78643K 1318 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 1606 0 1603 19 18 1 4 0 8 0 rtentry 112 1483 0 1415 4 1 3 4 0 8 0 unpcb 144 21477 0 21463 183 179 4 11 0 8 3 syncache 296 133 0 133 31 31 0 1 0 8 0 sackhl 24 1 0 1 1 1 0 1 0 8 0 tcpqe 32 282 50 282 8 8 0 1 0 8 0 tcpcb 776 11918 0 11908 207 199 8 15 0 8 6 arp 88 222 0 209 1 0 1 1 0 8 0 ipq 40 7 0 7 3 3 0 1 0 8 0 ipqe 40 50 0 50 3 3 0 1 0 8 0 inpcb 336 21944 0 21931 266 259 7 13 0 8 5 ip6q 72 151 0 151 6 5 1 1 0 8 1 ip6af 40 302 0 302 6 5 1 1 0 8 1 nd6 48 341 0 326 1 0 1 1 0 8 0 pkpcb 40 24 0 24 6 6 0 1 0 8 0 kcovpl 48 105 0 98 1 0 1 1 0 8 0 mppekey 1024 116 0 116 8 8 0 1 0 8 0 ppxss 1160 470 0 470 41 40 1 1 0 8 1 pppxif 1360 296 0 296 32 32 0 1 0 8 0 pfstscr 40 353 0 346 1 0 1 1 0 8 0 pfosfp 40 5 0 4 1 0 1 1 0 8 0 pfosfpen 112 5 0 0 1 0 1 1 0 8 0 pfanchor 1280 512 327 0 43 0 43 43 0 8 0 pfqueue 264 4 0 4 2 2 0 1 0 8 0 pfstitem 24 172 0 158 1 0 1 1 0 8 0 pfstkey 128 621 0 465 6 0 6 6 0 8 0 pfstate 352 312 0 305 1 0 1 1 0 8 0 rttmr 136 28 0 28 8 8 0 1 0 8 0 art_heap8 4096 6 0 5 5 4 1 3 0 8 0 art_heap4 256 6445 0 6111 81 53 28 29 0 8 2 art_table 32 6451 0 6116 4 0 4 4 0 8 0 art_node 16 1474 0 1414 1 0 1 1 0 8 0 sysvmsgpl 40 5 0 2 1 0 1 1 0 8 0 semapl 112 2485 0 2464 1 0 1 1 0 8 0 shmpl 112 137 0 9 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 25253 0 23790 93 0 93 93 0 8 0 ffsino 240 25253 0 23790 88 1 87 87 0 8 0 nchpl 144 54590 0 52966 63 0 63 63 0 8 0 rtmask 32 6 0 6 3 3 0 1 0 8 0 uvmvnodes 80 6084 0 0 125 0 125 125 0 8 0 vnodes 216 6084 0 0 338 0 338 338 0 8 0 namei 1024 198568 0 198568 17 16 1 2 0 8 1 vmpool 664 88 0 88 16 16 0 1 0 8 0 kstatmem 264 796 0 772 17 15 2 3 0 8 0 scsiplug 72 12 0 12 5 5 0 1 0 8 0 scxspl 216 145249 0 145249 40 39 1 8 0 8 1 plimitpl 152 2019 0 2005 1 0 1 1 0 8 0 sigapl 424 18394 0 18334 10 2 8 8 0 8 0 futexpl 64 195819 0 195819 15 14 1 1 0 8 1 knotepl 120 198263 0 198189 104 101 3 11 0 8 0 kqueuepl 184 3660 0 3652 55 54 1 7 0 8 0 pipepl 288 3896 0 3871 68 65 3 7 0 8 0 fdescpl 432 18312 0 18291 4 0 4 4 0 8 0 filepl 120 156761 0 156547 193 183 10 17 0 8 2 lockfpl 104 4476 0 4474 8 7 1 2 0 8 0 lockfspl 48 1378 0 1376 1 0 1 1 0 8 0 sessionpl 144 123 0 108 1 0 1 1 0 8 0 pgrppl 48 1426 0 1411 1 0 1 1 0 8 0 ucredpl 104 18632 0 18622 1 0 1 1 0 8 0 zombiepl 144 18335 0 18334 6 5 1 1 0 8 0 processpl 1008 18394 0 18334 15 6 9 9 0 8 0 procpl 696 45363 0 45288 38 29 9 10 0 8 1 sosppl 168 159 0 158 27 26 1 1 0 8 0 sockpl 456 45101 0 45065 847 833 14 44 0 8 8 mcl64k 65536 533 0 533 49 48 1 1 0 8 1 mcl16k 16384 263 0 263 44 44 0 1 0 8 0 mcl12k 12288 537 0 537 41 40 1 1 0 8 1 mcl9k 9216 197 0 197 46 46 0 1 0 8 0 mcl8k 8192 883 0 883 45 44 1 1 0 8 1 mcl4k 4096 2222 0 2222 25 24 1 1 0 8 1 mcl2k2 2112 137 0 137 48 48 0 1 0 8 0 mcl2k 2048 110916 0 110841 47 36 11 25 0 8 0 mtagpl 96 2187 0 2096 22 15 7 10 0 8 0 mbufpl 256 372303 0 372020 1276 1242 34 208 0 8 0 bufpl 288 29559 0 23162 458 0 458 458 0 8 0 anonpl 24 3429950 0 3411912 231 107 124 141 0 188 0 amapchunkpl 152 333951 0 333295 128 95 33 43 0 158 0 amappl16 200 32847 0 32186 207 169 38 49 0 8 0 amappl15 192 127 0 125 1 0 1 1 0 8 0 amappl14 184 518 0 504 2 1 1 2 0 8 0 amappl13 176 9 0 8 1 0 1 1 0 8 0 amappl12 168 1576 0 1573 1 0 1 1 0 8 0 amappl11 160 50 0 39 1 0 1 1 0 8 0 amappl10 152 130 0 120 1 0 1 1 0 8 0 amappl9 144 994 0 993 1 0 1 1 0 8 0 amappl8 136 706 0 599 5 1 4 4 0 8 0 amappl7 128 357 0 333 2 0 2 2 0 8 0 amappl6 120 647 0 631 1 0 1 1 0 8 0 amappl5 112 713 0 707 1 0 1 1 0 8 0 amappl4 104 1821 0 1793 1 0 1 1 0 8 0 amappl3 96 50752 0 50714 2 0 2 2 0 8 0 amappl2 88 19707 0 19637 3 1 2 3 0 8 0 amappl1 80 405483 0 404875 36 20 16 22 0 8 0 amappl 88 113923 0 113766 5 0 5 5 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 139 0 9 3 0 3 3 0 8 0 uaddrrnd 24 18400 0 18379 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 18400 0 18379 1 0 1 1 0 8 0 vmmpekpl 168 129702 0 129641 3 0 3 3 0 8 0 vmmpepl 168 1692751 0 1690329 485 341 144 166 0 357 2 vmsppl 272 18399 0 18379 4 2 2 3 0 8 0 rwobjpl 24 421653 0 413732 60 10 50 51 0 8 0 pdppl 4096 36806 0 36758 1211 1147 64 68 0 8 16 pvpl 32 6848338 0 6825387 552 343 209 258 0 265 0 pmappl 216 18399 0 18379 2 0 2 2 0 8 0 extentpl 40 56 0 38 1 0 1 1 0 8 0 phpool 112 3823 0 3027 28 3 25 28 0 8 0 ddb> machine ddbcpu 0 No such command ddb> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82728421) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff827a20ae,ffffffff827d17fa,12f,ffffffff827b21bf) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000e1a000) at tun_clone_destroy+0x234 sys/net/if_tun.c:303 if_clone_destroy(ffff80002e90c3c0) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff8000fffec030,ffff80002e90c4d8,ffff80002e90c520) at sys_ioctl+0x49e syscall(ffff80002e90c5a0) at syscall+0x4e6 sys/arch/amd64/amd64/trap.c:626 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xc6fc06cc190, count: -8 ddb> machine ddbcpu 1 No such command ddb> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82728421) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff827a20ae,ffffffff827d17fa,12f,ffffffff827b21bf) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000e1a000) at tun_clone_destroy+0x234 sys/net/if_tun.c:303 if_clone_destroy(ffff80002e90c3c0) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff8000fffec030,ffff80002e90c4d8,ffff80002e90c520) at sys_ioctl+0x49e syscall(ffff80002e90c5a0) at syscall+0x4e6 sys/arch/amd64/amd64/trap.c:626 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xc6fc06cc190, count: -8