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 *240763 5155 0 0 0x4000000 0 syz-executor.0 db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82574758) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff825ea5f6,ffffffff82617445,12f,ffffffff825f9455) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000c6e800) at tun_clone_destroy+0x234 sys/net/if_tun.c:303 if_clone_destroy(ffff8000298bd200) at if_clone_destroy+0x132 sys/net/if.c:1276 sys_ioctl(ffff800021710a80,ffff8000298bd318,ffff8000298bd370) at sys_ioctl+0x49e syscall(ffff8000298bd3e0) at syscall+0x447 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xb8b07c3cbc0, 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(ffffffff82574758) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff825ea5f6,ffffffff82617445,12f,ffffffff825f9455) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000c6e800) at tun_clone_destroy+0x234 sys/net/if_tun.c:303 if_clone_destroy(ffff8000298bd200) at if_clone_destroy+0x132 sys/net/if.c:1276 sys_ioctl(ffff800021710a80,ffff8000298bd318,ffff8000298bd370) at sys_ioctl+0x49e syscall(ffff8000298bd3e0) at syscall+0x447 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xb8b07c3cbc0, count: -8 ddb> show registers rdi 0 rsi 0x1 rbp 0xffff8000298bd090 rbx 0x80206979 __kernel_virt_to_phys+0x206979 rdx 0xffff800000bf3ec0 rcx 0 rax 0xffff800021710a80 r8 0 r9 0x8080808080808080 r10 0xe58384f1c2cc1ba3 r11 0x8fb9b81ac0c802ad r12 0 r13 0 r14 0 r15 0x1 rip 0xffffffff824ed858 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff8000298bd080 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb> show proc PROC (syz-executor.0) pid=240763 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffff8000217117a0,0xffffffff829d4848 process=0xffff80002170a7f8 user=0xffff8000298b8000, vmspace=0xfffffd8069973770 estcpu=36, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb> ps PID TID PPID UID S FLAGS WAIT COMMAND 5155 950 17696 0 2 0 syz-executor.0 * 5155 240763 17696 0 7 0x4000000 syz-executor.0 62715 8176 45840 0 2 0x480 syz-executor.2 62715 111099 45840 0 3 0x4000080 fsleep syz-executor.2 65078 163389 64727 0 2 0 syz-executor.6 65078 262959 64727 0 3 0x4000080 fsleep syz-executor.6 85918 258290 89044 0 2 0 syz-executor.4 85918 240258 89044 0 3 0x4000080 fsleep syz-executor.4 89349 189111 93286 0 2 0 syz-executor.5 89349 115591 93286 0 3 0x4000080 netcon2 syz-executor.5 40592 391170 56024 0 2 0x2 syz-executor.7 64727 3996 56024 0 3 0x82 nanoslp syz-executor.6 89044 250904 56024 0 3 0x82 nanoslp syz-executor.4 97086 493456 56024 0 2 0x2 syz-executor.3 93286 316446 56024 0 3 0x82 nanoslp syz-executor.5 17696 80134 56024 0 2 0x482 syz-executor.0 32489 230320 1 0 3 0x100083 ttyopn getty 45840 217860 56024 0 3 0x82 nanoslp syz-executor.2 79703 357582 56024 0 2 0x482 syz-executor.1 25625 21410 0 0 3 0x14280 nfsidl nfsio 90820 97713 0 0 3 0x14280 nfsidl nfsio 12073 366667 0 0 3 0x14280 nfsidl nfsio 38825 506852 0 0 3 0x14280 nfsidl nfsio 5673 40981 0 0 3 0x14280 nfsidl nfsio 64377 310111 0 0 3 0x14280 nfsidl nfsio 47785 149101 0 0 3 0x14280 nfsidl nfsio 89074 305741 0 0 3 0x14280 nfsidl nfsio 8429 356349 0 0 3 0x14280 nfsidl nfsio 86755 222053 0 0 3 0x14280 nfsidl nfsio 67770 368904 0 0 3 0x14280 nfsidl nfsio 7536 46022 0 0 3 0x14280 nfsidl nfsio 40956 66259 0 0 3 0x14280 nfsidl nfsio 2107 236725 0 0 3 0x14280 nfsidl nfsio 722 183175 0 0 3 0x14280 nfsidl nfsio 41550 41799 0 0 3 0x14280 nfsidl nfsio 14434 180256 0 0 3 0x14280 nfsidl nfsio 91129 266848 0 0 3 0x14280 nfsidl nfsio 77384 23904 0 0 3 0x14280 nfsidl nfsio 33101 229749 0 0 3 0x14280 nfsidl nfsio 71516 240170 0 0 3 0x14200 bored sosplice 56024 302771 69306 0 3 0x82 thrsleep syz-fuzzer 56024 375638 69306 0 2 0x4000002 syz-fuzzer 56024 250398 69306 0 3 0x4000082 thrsleep syz-fuzzer 56024 15484 69306 0 3 0x4000082 wait syz-fuzzer 56024 489215 69306 0 3 0x4000082 kqread syz-fuzzer 56024 394278 69306 0 3 0x4000082 wait syz-fuzzer 56024 125682 69306 0 3 0x4000082 wait syz-fuzzer 56024 388033 69306 0 3 0x4000082 wait syz-fuzzer 56024 160252 69306 0 3 0x4000082 thrsleep syz-fuzzer 56024 503736 69306 0 3 0x4000082 wait syz-fuzzer 56024 144974 69306 0 3 0x4000082 wait syz-fuzzer 56024 158180 69306 0 3 0x4000082 thrsleep syz-fuzzer 56024 371962 69306 0 3 0x4000082 wait syz-fuzzer 56024 497297 69306 0 3 0x4000082 wait syz-fuzzer 69306 483679 44621 0 3 0x10008a sigsusp ksh 44621 315370 96742 0 3 0x9a kqread sshd 96742 468990 1 0 3 0x88 kqread sshd 3497 37423 47365 73 3 0x1100090 kqread syslogd 47365 434995 1 0 3 0x100082 netio syslogd 44909 93197 1 0 3 0x100080 kqread resolvd 26501 61995 0 0 3 0x14200 bored smr 32203 429605 0 0 2 0x14200 zerothread 98398 442225 0 0 3 0x14200 aiodoned aiodoned 40113 186286 0 0 3 0x14200 syncer update 9061 324770 0 0 3 0x14200 cleaner cleaner 32892 34023 0 0 3 0x14200 reaper reaper 75371 498750 0 0 3 0x14200 pgdaemon pagedaemon 61879 385508 0 0 3 0x14200 bored viomb 5454 131210 0 0 3 0x40014200 acpi0 acpi0 48975 473745 0 0 3 0x14200 bored softnet 1741 506652 0 0 3 0x14200 bored softnet 68192 94171 0 0 3 0x14200 bored softnet 81564 197168 0 0 3 0x14200 bored softnet 17080 503295 0 0 3 0x14200 bored systqmp 6720 53694 0 0 3 0x14200 bored systq 62143 471700 0 0 3 0x40014200 bored softclock 9438 22848 0 0 3 0x40014200 idle0 1 495753 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 10218 6441K 7706K 78643K 18700 0 pcb 13 18K 23K 78643K 5864 0 rtable 241 17K 18K 78643K 8347 0 ifaddr 149 38K 40K 78643K 3000 0 sysctl 2 0K 2K 78643K 9 0 counters 29 17K 17K 78643K 625 0 ioctlops 0 0K 4K 78643K 4098 0 iov 0 0K 24K 78643K 19003 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 4 0 vnodes 1451 91K 92K 78643K 24305 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 13K 78643K 325 0 VM map 2 0K 0K 78643K 2 0 sem 15 20K 40K 78643K 43 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 15 53K 69K 78643K 32374 0 sigio 0 0K 0K 78643K 969 0 proc 71 44K 75K 78643K 5821 0 subproc 104 6K 6K 78643K 1986 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 1624 0 in_multi 79 5K 6K 78643K 2550 0 ether_multi 1 0K 0K 78643K 135 0 mrt 2 0K 0K 78643K 82 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 247 1102K 1102K 78643K 247 0 exec 0 0K 2K 78643K 8714 0 pfkey data 0 0K 0K 78643K 65 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 338 126K 142K 78643K 176374 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 1342 0 NDP 16 0K 2K 78643K 915 0 temp 145 4726K 66422K 78643K 316321 0 kqueue 6 10K 28K 78643K 2267 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 6688 0 6687 68 67 1 5 0 8 0 rtentry 112 2293 0 2199 5 1 4 4 0 8 0 unpcb 144 28967 0 28959 275 274 1 11 0 8 0 syncache 296 54 0 54 15 15 0 1 0 8 0 sackhl 24 1 0 1 1 1 0 1 0 8 0 tcpqe 32 26 0 26 9 9 0 1 0 8 0 tcpcb 768 13046 0 13033 481 477 4 22 0 8 2 arp 88 317 0 300 1 0 1 1 0 8 0 ipq 40 30 0 30 16 16 0 1 0 8 0 ipqe 40 83 0 83 16 16 0 1 0 8 0 inpcb 336 35816 0 35809 453 447 6 17 0 8 5 nd6 48 584 0 563 1 0 1 1 0 8 0 pkpcb 40 188 0 188 19 19 0 1 0 8 0 kcovpl 48 151 0 143 1 0 1 1 0 8 0 ppxss 1160 378 0 378 50 50 0 1 0 8 0 pfstscr 40 111 0 104 1 0 1 1 0 8 0 pfosfp 40 74 0 71 1 0 1 1 0 8 0 pfosfpen 112 74 0 71 1 0 1 1 0 8 0 pfrke_plain 168 37 0 37 9 9 0 1 0 8 0 pfrktable 1344 300 0 293 4 3 1 2 0 8 0 pfanchor 1280 481 0 183 27 1 26 26 0 8 0 pftag 88 6 0 3 2 1 1 1 0 8 0 pfqueue 264 8 0 8 2 2 0 1 0 8 0 pfstitem 24 24 0 10 1 0 1 1 0 8 0 pfstkey 120 222 0 216 1 0 1 1 0 8 0 pfstate 336 111 0 104 1 0 1 1 0 8 0 pfrule 1360 209 0 200 6 5 1 1 0 8 0 rttmr 136 3 0 3 1 1 0 1 0 8 0 art_heap8 4096 11 0 10 11 10 1 2 0 8 0 art_heap4 256 10248 0 9886 80 54 26 30 0 8 0 art_table 32 10259 0 9896 6 2 4 4 0 8 0 art_node 16 2269 0 2189 1 0 1 1 0 8 0 sysvmsgpl 40 40 0 0 1 0 1 1 0 8 0 semupl 112 7 0 7 2 2 0 1 0 8 0 semapl 112 13 0 0 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 59380 0 57807 99 0 99 99 0 8 0 ffsino 240 59380 0 57807 93 0 93 93 0 8 0 nchpl 144 102572 0 102033 63 42 21 63 0 8 0 rtmask 32 68 0 68 15 15 0 1 0 8 0 uvmvnodes 80 8253 0 0 169 0 169 169 0 8 0 vnodes 216 8253 0 0 459 0 459 459 0 8 0 namei 1024 412031 0 412030 15 14 1 2 0 8 0 vcpupl 2048 34 0 0 5 0 5 5 0 8 0 vmpool 536 34 0 0 3 0 3 3 0 8 0 pfiaddrpl 120 96 0 87 4 3 1 1 0 8 0 kstatmem 264 1014 0 982 7 4 3 3 0 8 0 scsiplug 72 33 0 33 11 11 0 1 0 8 0 scxspl 216 257874 0 257874 48 47 1 8 0 8 1 plimitpl 152 4862 0 4847 1 0 1 1 0 8 0 sigapl 424 32443 0 32382 13 5 8 8 0 8 0 futexpl 64 336682 0 336679 5 4 1 1 0 8 0 knotepl 120 417278 0 417214 241 237 4 18 0 8 1 kqueuepl 184 5961 0 5956 75 73 2 6 0 8 1 pipepl 288 7540 0 7512 158 155 3 11 0 8 0 fdescpl 432 32353 0 32330 7 4 3 4 0 8 0 filepl 120 301203 0 300978 322 309 13 19 0 8 6 lockfpl 104 8403 0 8402 12 11 1 3 0 8 0 lockfspl 48 1862 0 1861 1 0 1 1 0 8 0 sessionpl 144 167 0 152 1 0 1 1 0 8 0 pgrppl 48 374 0 359 1 0 1 1 0 8 0 ucredpl 104 91343 0 91332 1 0 1 1 0 8 0 zombiepl 144 32383 0 32382 4 3 1 1 0 8 0 processpl 1000 32443 0 32382 16 7 9 9 0 8 0 procpl 672 82972 0 82893 61 53 8 9 0 8 0 sosppl 168 221 0 221 43 42 1 1 0 8 1 sockpl 456 71801 0 71785 1417 1407 10 36 0 8 7 mcl64k 65536 3157 0 3157 38 37 1 1 0 8 1 mcl16k 16384 2476 0 2476 52 51 1 1 0 8 1 mcl12k 12288 1340 0 1340 60 59 1 1 0 8 1 mcl9k 9216 573 0 573 89 89 0 1 0 8 0 mcl8k 8192 1956 0 1956 50 50 0 5 0 8 0 mcl4k 4096 3155 0 3155 47 46 1 1 0 8 1 mcl2k2 2112 230 0 230 82 81 1 1 0 8 1 mcl2k 2048 163370 0 163335 69 63 6 12 0 8 0 mtagpl 96 239 0 239 12 12 0 4 0 8 0 mbufpl 256 669465 0 669343 2158 2142 16 409 0 8 0 bufpl 288 58448 0 50194 590 0 590 590 0 8 0 anonpl 24 6053867 0 6039715 352 241 111 153 0 188 0 amapchunkpl 152 554071 0 553483 226 199 27 48 0 158 0 amappl16 200 87870 0 87261 302 268 34 46 0 8 0 amappl15 192 4776 0 4772 5 4 1 1 0 8 0 amappl14 184 2079 0 2070 1 0 1 1 0 8 0 amappl13 176 6055 0 6053 1 0 1 1 0 8 0 amappl12 168 2783 0 2779 1 0 1 1 0 8 0 amappl11 160 4231 0 4220 1 0 1 1 0 8 0 amappl10 152 5930 0 5929 6 5 1 1 0 8 0 amappl9 144 3236 0 3233 22 21 1 1 0 8 0 amappl8 136 9357 0 9200 8 2 6 6 0 8 0 amappl7 128 5848 0 5825 1 0 1 1 0 8 0 amappl6 120 3515 0 3496 2 1 1 2 0 8 0 amappl5 112 29921 0 29911 1 0 1 1 0 8 0 amappl4 104 13255 0 13221 3 2 1 2 0 8 0 amappl3 96 97030 0 96990 2 0 2 2 0 8 0 amappl2 88 8991 0 8956 3 1 2 2 0 8 0 amappl1 80 784186 0 783594 32 17 15 21 0 8 0 amappl 88 172846 0 172688 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 32387 0 32330 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 32387 0 32330 1 0 1 1 0 8 0 vmmpekpl 168 236173 0 236109 4 0 4 4 0 8 0 vmmpepl 168 3179147 0 3176593 519 386 133 163 0 357 0 vmsppl 272 32386 0 32330 7 2 5 5 0 8 0 rwobjpl 24 748387 0 738410 68 6 62 62 0 8 0 pdppl 4096 64780 0 64694 1958 1866 92 98 0 8 6 pvpl 32 12167514 0 12148779 685 500 185 269 0 265 0 pmappl 216 32386 0 32330 4 0 4 4 0 8 0 extentpl 40 56 0 38 1 0 1 1 0 8 0 phpool 112 5896 0 4944 47 16 31 36 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(ffffffff82574758) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff825ea5f6,ffffffff82617445,12f,ffffffff825f9455) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000c6e800) at tun_clone_destroy+0x234 sys/net/if_tun.c:303 if_clone_destroy(ffff8000298bd200) at if_clone_destroy+0x132 sys/net/if.c:1276 sys_ioctl(ffff800021710a80,ffff8000298bd318,ffff8000298bd370) at sys_ioctl+0x49e syscall(ffff8000298bd3e0) at syscall+0x447 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xb8b07c3cbc0, 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(ffffffff82574758) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff825ea5f6,ffffffff82617445,12f,ffffffff825f9455) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000c6e800) at tun_clone_destroy+0x234 sys/net/if_tun.c:303 if_clone_destroy(ffff8000298bd200) at if_clone_destroy+0x132 sys/net/if.c:1276 sys_ioctl(ffff800021710a80,ffff8000298bd318,ffff8000298bd370) at sys_ioctl+0x49e syscall(ffff8000298bd3e0) at syscall+0x447 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xb8b07c3cbc0, count: -8