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+0x18: addq $0x8,%rsp TID PID UID PRFLAGS PFLAGS CPU COMMAND *420597 31597 0 0x2 0 0 ifconfig db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82722f34) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff827a0c78,ffffffff827d347f,13b,ffffffff827b3ae6) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000da3000) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff800025ba6940) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff80002e8488a0,ffff800025ba6a50,ffff800025ba6aa0) at sys_ioctl+0x49e syscall(ffff800025ba6b20) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffead50, 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+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82722f34) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff827a0c78,ffffffff827d347f,13b,ffffffff827b3ae6) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000da3000) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff800025ba6940) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff80002e8488a0,ffff800025ba6a50,ffff800025ba6aa0) at sys_ioctl+0x49e syscall(ffff800025ba6b20) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffead50, count: -8 ddb> show registers rdi 0 rsi 0x1 rbp 0xffff800025ba67d0 rbx 0x80206979 __kernel_virt_to_phys+0x206979 rdx 0 rcx 0 rax 0xffff80002e8488a0 r8 0x101010101010101 r9 0x8080808080808080 r10 0xd05b01a7f3102963 r11 0x6213c39f25c8d2f6 r12 0 r13 0 r14 0 r15 0x1 rip 0xffffffff81a69eb8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800025ba67c0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb> show proc PROC (ifconfig) pid=420597 stat=onproc flags process=2 proc=0 pri=85, usrpri=85, nice=20 forw=0xffffffffffffffff, list=0xffff80002e849ba8,0xffffffff82cf3498 process=0xffff80002ccde7e8 user=0xffff800025ba1000, vmspace=0xfffffd8069b5fd80 estcpu=35, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb> ps PID TID PPID UID S FLAGS WAIT COMMAND *31597 420597 97794 0 7 0x2 ifconfig 97794 364144 24426 0 3 0x10008a sigsusp sh 24426 443806 42316 0 3 0x82 wait syz-executor.0 66772 163629 42316 0 3 0x82 piperd syz-executor.2 63135 448720 42316 0 3 0x82 piperd syz-executor.6 68648 125019 42316 0 3 0x82 piperd syz-executor.7 81408 321302 42316 0 3 0x82 piperd syz-executor.1 28877 515894 42316 0 3 0x82 piperd syz-executor.3 28711 128141 42316 0 3 0x82 piperd syz-executor.4 91422 119765 42316 0 3 0x82 piperd syz-executor.5 95234 450333 0 0 3 0x14280 nfsidl nfsio 70898 35468 0 0 3 0x14280 nfsidl nfsio 8234 373380 0 0 3 0x14280 nfsidl nfsio 9973 488026 0 0 3 0x14280 nfsidl nfsio 94984 56840 0 0 3 0x14280 nfsidl nfsio 81016 327181 0 0 3 0x14280 nfsidl nfsio 8701 494042 0 0 3 0x14280 nfsidl nfsio 57109 220505 0 0 3 0x14280 nfsidl nfsio 84879 184320 0 0 3 0x14280 nfsidl nfsio 50882 30632 0 0 3 0x14280 nfsidl nfsio 88639 430831 0 0 3 0x14280 nfsidl nfsio 63666 119493 0 0 3 0x14280 nfsidl nfsio 50864 74575 0 0 3 0x14280 nfsidl nfsio 44749 165563 0 0 3 0x14280 nfsidl nfsio 67629 215269 0 0 3 0x14280 nfsidl nfsio 56391 125607 0 0 3 0x14280 nfsidl nfsio 55955 70109 0 0 3 0x14280 nfsidl nfsio 99193 369424 0 0 3 0x14280 nfsidl nfsio 3801 112162 0 0 3 0x14280 nfsidl nfsio 33340 100438 0 0 3 0x14280 nfsidl nfsio 21717 265926 1 0 3 0x100083 ttyin getty 42367 293553 0 0 3 0x14200 bored sosplice 42316 121 25230 0 3 0x82 wait syz-fuzzer 42316 264824 25230 0 3 0x4000082 nanoslp syz-fuzzer 42316 64638 25230 0 3 0x4000082 thrsleep syz-fuzzer 42316 95490 25230 0 3 0x4000082 thrsleep syz-fuzzer 42316 137828 25230 0 3 0x4000082 thrsleep syz-fuzzer 42316 123522 25230 0 3 0x4000082 wait syz-fuzzer 42316 291027 25230 0 3 0x4000082 wait syz-fuzzer 42316 125941 25230 0 3 0x4000082 wait syz-fuzzer 42316 349629 25230 0 3 0x4000082 wait syz-fuzzer 42316 322331 25230 0 3 0x4000082 thrsleep syz-fuzzer 42316 364264 25230 0 3 0x4000082 thrsleep syz-fuzzer 42316 142880 25230 0 3 0x4000082 wait syz-fuzzer 42316 457160 25230 0 3 0x4000082 wait syz-fuzzer 42316 238597 25230 0 3 0x4000082 wait syz-fuzzer 25230 332198 77396 0 3 0x10008a sigsusp ksh 77396 316409 5541 0 3 0x9a kqread sshd 5541 1493 1 0 3 0x88 kqread sshd 49748 225178 32491 73 3 0x1100090 kqread syslogd 32491 305642 1 0 3 0x100082 netio syslogd 53386 41098 1 0 3 0x100080 kqread resolvd 72171 231153 93291 77 2 0x100092 dhcpleased 62791 30311 93291 77 3 0x100092 kqread dhcpleased 93291 90391 1 0 3 0x80 kqread dhcpleased 5673 343083 0 0 3 0x14200 bored smr 99723 31592 0 0 2 0x14200 zerothread 44326 31846 0 0 3 0x14200 aiodoned aiodoned 49263 55318 0 0 3 0x14200 syncer update 49544 257879 0 0 3 0x14200 cleaner cleaner 19283 336 0 0 3 0x14200 reaper reaper 86358 219642 0 0 3 0x14200 pgdaemon pagedaemon 6814 392722 0 0 3 0x14200 bored viomb 60415 182773 0 0 3 0x40014200 acpi0 acpi0 92754 439735 0 0 3 0x14200 bored softnet 86732 329236 0 0 3 0x14200 bored softnet 97964 324991 0 0 3 0x14200 bored softnet 49944 338092 0 0 3 0x14200 bored softnet 70105 319937 0 0 3 0x14200 bored systqmp 69961 494699 0 0 3 0x14200 bored systq 44460 17602 0 0 3 0x40014200 bored softclock 14660 71066 0 0 3 0x40014200 idle0 1 54898 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 10224 6430K 7073K 78643K 28681 0 pcb 13 26K 34K 78643K 3260 0 rtable 182 15K 16K 78643K 3848 0 ifaddr 73 22K 23K 78643K 1202 0 sysctl 3 1K 2K 78643K 11 0 counters 27 17K 17K 78643K 393 0 ioctlops 0 0K 4K 78643K 1313 0 iov 0 0K 28K 78643K 1481 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 4 0 vnodes 1470 92K 93K 78643K 8728 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 9K 78643K 91 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 0K 78643K 1247 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 12 41K 73K 78643K 10199 0 sigio 0 0K 0K 78643K 579 0 proc 71 67K 75K 78643K 2754 0 subproc 104 6K 7K 78643K 1040 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 552 0 in_multi 58 3K 6K 78643K 1512 0 ether_multi 1 0K 0K 78643K 55 0 mrt 2 0K 0K 78643K 38 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 241 1076K 1076K 78643K 241 0 exec 0 0K 1K 78643K 3252 0 pfkey data 0 0K 0K 78643K 12 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 278 85K 102K 78643K 65355 0 UVM aobj 131 4K 4K 78643K 134 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 339 0 NDP 12 0K 1K 78643K 461 0 temp 128 5770K 6794K 78643K 114144 0 kqueue 12 18K 26K 78643K 939 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 1209 0 1206 19 16 3 3 0 8 2 rtentry 112 1335 0 1260 5 2 3 4 0 8 0 unpcb 144 13391 0 13378 110 108 2 10 0 8 1 syncache 296 35 0 35 9 9 0 1 0 8 0 sackhl 24 1 0 1 1 1 0 1 0 8 0 tcpqe 32 380 0 380 7 7 0 2 0 8 0 tcpcb 776 28395 0 28391 605 596 9 34 0 8 8 arp 88 178 0 163 1 0 1 1 0 8 0 ipq 40 9 0 9 4 4 0 1 0 8 0 ipqe 40 29 0 29 4 4 0 1 0 8 0 inpcb 336 37075 0 37067 460 451 9 27 0 8 8 nd6 48 301 0 286 1 0 1 1 0 8 0 pkpcb 40 133 0 133 14 14 0 1 0 8 0 kcovpl 48 80 0 72 1 0 1 1 0 8 0 mppekey 1024 9 0 9 4 4 0 1 0 8 0 ppxss 1160 197 0 197 19 18 1 1 0 8 1 pppxif 1360 128 0 128 18 17 1 1 0 8 1 pfstscr 40 16 0 10 1 0 1 1 0 8 0 pfanchor 1280 1039 3 586 47 4 43 43 0 8 0 pfqueue 264 129 0 129 10 10 0 1 0 8 0 pfstitem 24 10 0 0 1 0 1 1 0 8 0 pfstkey 128 26 0 20 1 0 1 1 0 8 0 pfstate 352 13 0 8 1 0 1 1 0 8 0 rttmr 136 6 0 6 2 2 0 1 0 8 0 art_heap8 4096 7 0 6 5 4 1 3 0 8 0 art_heap4 256 6286 0 6009 66 43 23 30 0 8 0 art_table 32 6293 0 6015 5 2 3 4 0 8 0 art_node 16 1320 0 1257 1 0 1 1 0 8 0 sysvmsgpl 40 10 0 4 1 0 1 1 0 8 0 semupl 112 6 0 6 1 1 0 1 0 8 0 semapl 112 1242 0 1232 1 0 1 1 0 8 0 shmpl 112 131 0 3 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 14606 0 13142 92 0 92 92 0 8 0 ffsino 240 14606 0 13142 87 0 87 87 0 8 0 nchpl 144 27446 0 25816 63 1 62 63 0 8 0 rtmask 32 4 0 4 2 2 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 104271 0 104271 6 5 1 3 0 8 1 vmpool 664 13 0 13 4 4 0 1 0 8 0 kstatmem 264 456 0 432 3 1 2 3 0 8 0 scsiplug 72 12 0 12 4 3 1 1 0 8 1 scxspl 216 83464 0 83464 29 28 1 8 0 8 1 plimitpl 152 1605 0 1590 1 0 1 1 0 8 0 sigapl 424 10373 0 10313 8 0 8 8 0 8 0 futexpl 64 112164 0 112164 5 4 1 1 0 8 1 knotepl 120 118446 0 118364 56 49 7 11 0 8 3 kqueuepl 184 2168 0 2160 24 23 1 4 0 8 0 pipepl 288 3271 0 3243 45 42 3 11 0 8 0 fdescpl 432 10330 0 10307 5 1 4 4 0 8 0 filepl 120 103521 0 103288 147 134 13 17 0 8 5 lockfpl 104 2408 0 2406 4 2 2 2 0 8 1 lockfspl 48 677 0 675 1 0 1 1 0 8 0 sessionpl 144 96 0 80 1 0 1 1 0 8 0 pgrppl 48 270 0 254 1 0 1 1 0 8 0 ucredpl 104 10922 0 10908 1 0 1 1 0 8 0 zombiepl 144 10313 0 10313 3 2 1 1 0 8 1 processpl 1008 10373 0 10313 11 2 9 9 0 8 0 procpl 696 24915 0 24842 20 11 9 10 0 8 0 sosppl 168 76 0 76 17 16 1 1 0 8 1 sockpl 456 51833 0 51805 1150 1133 17 42 0 8 12 mcl64k 65536 307 0 307 24 23 1 1 0 8 1 mcl16k 16384 143 0 143 22 21 1 1 0 8 1 mcl12k 12288 350 0 350 22 21 1 1 0 8 1 mcl9k 9216 145 0 145 23 23 0 1 0 8 0 mcl8k 8192 559 0 559 21 20 1 1 0 8 1 mcl4k 4096 1176 0 1176 10 9 1 1 0 8 1 mcl2k2 2112 70 0 70 23 23 0 1 0 8 0 mcl2k 2048 95148 0 95072 69 58 11 35 0 8 0 mtagpl 96 1009 0 854 18 12 6 6 0 8 0 mbufpl 256 735896 0 735554 1044 1007 37 176 0 8 8 bufpl 288 20895 0 14501 457 0 457 457 0 8 0 anonpl 24 1950413 0 1936441 232 115 117 159 0 188 1 amapchunkpl 152 200209 0 199614 76 43 33 43 0 158 0 amappl16 200 18611 0 18005 119 85 34 57 0 8 0 amappl15 192 6 0 6 2 2 0 1 0 8 0 amappl14 184 421 0 408 2 1 1 2 0 8 0 amappl13 176 17 0 17 4 4 0 1 0 8 0 amappl12 168 1259 0 1255 1 0 1 1 0 8 0 amappl11 160 50 0 39 1 0 1 1 0 8 0 amappl10 152 145 0 130 1 0 1 1 0 8 0 amappl9 144 985 0 984 3 2 1 1 0 8 0 amappl8 136 511 0 437 3 0 3 3 0 8 0 amappl7 128 308 0 284 2 0 2 2 0 8 0 amappl6 120 507 0 491 2 1 1 2 0 8 0 amappl5 112 530 0 522 1 0 1 1 0 8 0 amappl4 104 1322 0 1291 2 1 1 2 0 8 0 amappl3 96 28321 0 28282 2 0 2 2 0 8 0 amappl2 88 11307 0 11239 3 0 3 3 0 8 0 amappl1 80 230233 0 229619 30 14 16 26 0 8 0 amappl 88 64021 0 63874 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 133 0 3 3 0 3 3 0 8 0 uaddrrnd 24 10343 0 10320 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 10343 0 10320 1 0 1 1 0 8 0 vmmpekpl 168 79693 0 79638 3 0 3 3 0 8 0 vmmpepl 168 966916 0 964590 348 205 143 157 0 357 4 vmsppl 344 10342 0 10320 3 0 3 3 0 8 0 rwobjpl 24 244681 0 236973 52 4 48 50 0 8 0 pdppl 4096 20692 0 20640 748 686 62 68 0 8 10 pvpl 32 3967394 0 3948307 557 345 212 360 0 265 13 pmappl 216 10342 0 10320 2 0 2 2 0 8 0 extentpl 40 56 0 38 1 0 1 1 0 8 0 phpool 112 3184 0 2392 27 1 26 27 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(ffffffff82722f34) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff827a0c78,ffffffff827d347f,13b,ffffffff827b3ae6) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000da3000) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff800025ba6940) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff80002e8488a0,ffff800025ba6a50,ffff800025ba6aa0) at sys_ioctl+0x49e syscall(ffff800025ba6b20) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffead50, 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(ffffffff82722f34) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff827a0c78,ffffffff827d347f,13b,ffffffff827b3ae6) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000da3000) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff800025ba6940) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff80002e8488a0,ffff800025ba6a50,ffff800025ba6aa0) at sys_ioctl+0x49e syscall(ffff800025ba6b20) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffead50, count: -8