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 *133199 6472 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(ffff800000dd8000) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff800029a24370) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff8000fffe9b68,ffff800029a24480,ffff800029a244d0) at sys_ioctl+0x49e syscall(ffff800029a24550) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffcb6d0, 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(ffff800000dd8000) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff800029a24370) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff8000fffe9b68,ffff800029a24480,ffff800029a244d0) at sys_ioctl+0x49e syscall(ffff800029a24550) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffcb6d0, count: -8 ddb> show registers rdi 0 rsi 0x1 rbp 0xffff800029a24200 rbx 0x80206979 __kernel_virt_to_phys+0x206979 rdx 0 rcx 0 rax 0xffff8000fffe9b68 r8 0 r9 0x8080808080808080 r10 0xf57958aad67e0811 r11 0xd4bb8b237159c1db r12 0 r13 0 r14 0 r15 0x1 rip 0xffffffff81a69eb8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800029a241f0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb> show proc PROC (ifconfig) pid=133199 stat=onproc flags process=2 proc=0 pri=84, usrpri=85, nice=20 forw=0xffffffffffffffff, list=0xffff8000fffe8860,0xffffffff82cf3498 process=0xffff800022d6e008 user=0xffff800029a1f000, vmspace=0xfffffd8069b88168 estcpu=35, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb> ps PID TID PPID UID S FLAGS WAIT COMMAND * 6472 133199 28035 0 7 0x2 ifconfig 28035 134807 29346 0 3 0x10008a sigsusp sh 29346 132255 56003 0 3 0x82 wait syz-executor.0 96765 279522 56003 0 3 0x82 piperd syz-executor.6 64236 450720 56003 0 3 0x82 piperd syz-executor.3 65917 79681 56003 0 3 0x82 nanoslp syz-executor.2 28755 464094 56003 0 3 0x82 piperd syz-executor.7 97453 233369 56003 0 3 0x82 piperd syz-executor.5 47187 279461 56003 0 3 0x82 piperd syz-executor.1 51377 272767 1 0 3 0x100083 ttyin getty 56747 434786 56003 0 3 0x82 piperd syz-executor.4 89967 508596 0 0 3 0x14280 nfsidl nfsio 48015 64974 0 0 3 0x14280 nfsidl nfsio 82094 242682 0 0 3 0x14280 nfsidl nfsio 76683 167715 0 0 3 0x14280 nfsidl nfsio 27911 30738 0 0 3 0x14280 nfsidl nfsio 91756 6765 0 0 3 0x14280 nfsidl nfsio 93340 509354 0 0 3 0x14280 nfsidl nfsio 35906 414022 0 0 3 0x14280 nfsidl nfsio 41618 219945 0 0 3 0x14280 nfsidl nfsio 46330 75267 0 0 3 0x14280 nfsidl nfsio 50458 345723 0 0 3 0x14280 nfsidl nfsio 98442 218863 0 0 3 0x14280 nfsidl nfsio 7253 170295 0 0 3 0x14280 nfsidl nfsio 62657 275358 0 0 3 0x14280 nfsidl nfsio 91853 235074 0 0 3 0x14280 nfsidl nfsio 74197 413418 0 0 3 0x14280 nfsidl nfsio 25667 88561 0 0 3 0x14280 nfsidl nfsio 43676 183222 0 0 3 0x14280 nfsidl nfsio 34585 12139 0 0 3 0x14280 nfsidl nfsio 46404 420271 0 0 3 0x14280 nfsidl nfsio 13369 9553 0 0 3 0x14200 bored sosplice 56003 137796 75857 0 3 0x82 thrsleep syz-fuzzer 56003 323999 75857 0 3 0x4000082 nanoslp syz-fuzzer 56003 49645 75857 0 3 0x4000082 wait syz-fuzzer 56003 84862 75857 0 3 0x4000082 wait syz-fuzzer 56003 157970 75857 0 3 0x4000082 wait syz-fuzzer 56003 56602 75857 0 3 0x4000082 thrsleep syz-fuzzer 56003 416150 75857 0 3 0x4000082 thrsleep syz-fuzzer 56003 299408 75857 0 3 0x4000082 wait syz-fuzzer 56003 325966 75857 0 3 0x4000082 thrsleep syz-fuzzer 56003 106595 75857 0 3 0x4000082 wait syz-fuzzer 56003 433207 75857 0 3 0x4000082 thrsleep syz-fuzzer 56003 120004 75857 0 3 0x4000082 wait syz-fuzzer 56003 429025 75857 0 3 0x4000082 wait syz-fuzzer 56003 135539 75857 0 3 0x4000082 wait syz-fuzzer 75857 51834 54724 0 3 0x10008a sigsusp ksh 54724 470734 29528 0 3 0x9a kqread sshd 29528 177141 1 0 3 0x88 kqread sshd 49156 485326 47452 73 3 0x1100090 kqread syslogd 47452 125021 1 0 3 0x100082 netio syslogd 47768 41752 1 0 3 0x100080 kqread resolvd 70482 357206 36200 77 2 0x100092 dhcpleased 53672 403284 36200 77 3 0x100092 kqread dhcpleased 36200 107388 1 0 3 0x80 kqread dhcpleased 21279 186830 0 0 3 0x14200 bored smr 77698 47590 0 0 2 0x14200 zerothread 45094 134428 0 0 3 0x14200 aiodoned aiodoned 76004 258075 0 0 3 0x14200 syncer update 16474 9591 0 0 3 0x14200 cleaner cleaner 12114 521093 0 0 3 0x14200 reaper reaper 83278 31441 0 0 3 0x14200 pgdaemon pagedaemon 10999 408177 0 0 3 0x14200 bored viomb 9854 204850 0 0 3 0x40014200 acpi0 acpi0 21445 224497 0 0 3 0x14200 bored softnet 8710 78754 0 0 3 0x14200 bored softnet 75024 508186 0 0 3 0x14200 bored softnet 30258 162705 0 0 3 0x14200 bored softnet 48162 361462 0 0 3 0x14200 bored systqmp 25744 76445 0 0 3 0x14200 bored systq 38937 94894 0 0 2 0x40014200 softclock 95554 418330 0 0 3 0x40014200 idle0 1 412307 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 10220 6417K 6877K 78643K 17475 0 pcb 13 18K 23K 78643K 1058 0 rtable 193 15K 15K 78643K 1835 0 ifaddr 83 23K 23K 78643K 636 0 sysctl 3 1K 2K 78643K 6 0 counters 27 17K 17K 78643K 269 0 ioctlops 0 0K 4K 78643K 587 0 iov 0 0K 24K 78643K 714 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 4 0 vnodes 1407 88K 88K 78643K 5119 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 9K 78643K 64 0 VM map 2 1K 1K 78643K 2 0 sem 10 1K 1K 78643K 19 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 13 45K 69K 78643K 5119 0 sigio 0 0K 0K 78643K 44 0 proc 70 67K 75K 78643K 1568 0 subproc 104 6K 7K 78643K 533 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 169 0 in_multi 81 5K 6K 78643K 654 0 ether_multi 1 0K 0K 78643K 27 0 mrt 1 0K 0K 78643K 20 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 229 1023K 1023K 78643K 229 0 exec 0 0K 1K 78643K 1415 0 pfkey data 0 0K 0K 78643K 67 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 259 79K 101K 78643K 33171 0 UVM aobj 131 4K 4K 78643K 139 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 158 0 NDP 12 0K 1K 78643K 215 0 temp 134 5770K 5970K 78643K 50044 0 kqueue 12 18K 24K 78643K 424 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 430 0 427 6 5 1 3 0 8 0 rtentry 112 608 0 526 5 2 3 4 0 8 0 unpcb 144 5656 0 5643 58 55 3 10 0 8 2 syncache 296 37 0 37 10 10 0 1 0 8 0 tcpqe 32 153 0 153 4 4 0 1 0 8 0 tcpcb 776 1892 0 1888 55 54 1 8 0 8 0 arp 88 88 0 73 1 0 1 1 0 8 0 ipq 40 7 0 7 3 3 0 1 0 8 0 ipqe 40 26 0 26 3 3 0 1 0 8 0 inpcb 336 14860 0 14852 141 132 9 18 0 8 8 nd6 48 139 0 120 1 0 1 1 0 8 0 pkpcb 40 15 0 15 4 4 0 1 0 8 0 kcovpl 48 41 0 33 1 0 1 1 0 8 0 mppekey 1024 10 0 10 4 4 0 1 0 8 0 ppxss 1160 149 0 149 11 11 0 1 0 8 0 pppxif 1360 131 0 131 8 8 0 1 0 8 0 pfstscr 40 12 0 3 1 0 1 1 0 8 0 pfosfp 40 8 0 6 1 0 1 1 0 8 0 pfosfpen 112 8 0 0 1 0 1 1 0 8 0 pfanchor 1280 512 9 0 43 0 43 43 0 8 0 pfstitem 24 18 0 0 1 0 1 1 0 8 0 pfstkey 128 24 0 21 1 0 1 1 0 8 0 pfstate 352 12 0 3 1 0 1 1 0 8 0 rttmr 136 3 0 3 1 1 0 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 2864 0 2485 53 29 24 29 0 8 0 art_table 32 2865 0 2485 7 3 4 4 0 8 0 art_node 16 597 0 525 1 0 1 1 0 8 0 sysvmsgpl 40 70 0 70 1 1 0 1 0 8 0 semupl 112 5 0 5 1 1 0 1 0 8 0 semapl 112 11 0 3 1 0 1 1 0 8 0 shmpl 112 136 0 8 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 8291 0 6858 91 0 91 91 0 8 0 ffsino 240 8291 0 6858 85 0 85 85 0 8 0 nchpl 144 14808 0 13176 63 1 62 63 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 54413 0 54413 5 4 1 3 0 8 1 vmpool 664 9 0 9 2 2 0 1 0 8 0 kstatmem 264 246 0 222 2 0 2 2 0 8 0 scsiplug 72 3 0 3 1 1 0 1 0 8 0 scxspl 216 41376 0 41376 22 21 1 8 0 8 1 plimitpl 152 746 0 730 1 0 1 1 0 8 0 sigapl 424 5405 0 5344 8 0 8 8 0 8 0 futexpl 64 53403 0 53403 1 0 1 1 0 8 1 knotepl 120 52020 0 51938 38 35 3 10 0 8 0 kqueuepl 184 1084 0 1076 16 15 1 4 0 8 0 pipepl 288 1847 0 1819 33 30 3 7 0 8 0 fdescpl 432 5327 0 5303 4 0 4 4 0 8 0 filepl 120 48694 0 48459 66 55 11 18 0 8 1 lockfpl 104 987 0 985 3 2 1 2 0 8 0 lockfspl 48 316 0 314 1 0 1 1 0 8 0 sessionpl 144 58 0 42 1 0 1 1 0 8 0 pgrppl 48 80 0 64 1 0 1 1 0 8 0 ucredpl 104 5471 0 5458 1 0 1 1 0 8 0 zombiepl 144 5345 0 5344 2 1 1 1 0 8 0 processpl 1008 5405 0 5344 10 1 9 9 0 8 0 procpl 696 12428 0 12354 14 5 9 10 0 8 0 sosppl 168 71 0 71 8 8 0 1 0 8 0 sockpl 456 20974 0 20950 493 482 11 45 0 8 8 mcl64k 65536 154 0 154 9 8 1 1 0 8 1 mcl16k 16384 53 0 53 14 13 1 1 0 8 1 mcl12k 12288 228 0 228 12 11 1 1 0 8 1 mcl9k 9216 65 0 65 10 10 0 1 0 8 0 mcl8k 8192 216 0 216 11 10 1 1 0 8 1 mcl4k 4096 491 0 491 4 3 1 1 0 8 1 mcl2k2 2112 32 0 32 11 11 0 1 0 8 0 mcl2k 2048 85035 0 84960 39 28 11 28 0 8 0 mtagpl 96 758 0 729 13 10 3 7 0 8 0 mbufpl 256 183579 0 183356 310 289 21 70 0 8 0 bufpl 288 12091 0 5696 459 1 458 458 0 8 0 anonpl 24 1030776 0 1016123 174 63 111 130 0 188 1 amapchunkpl 152 93208 0 92568 64 31 33 43 0 158 0 amappl16 200 10530 0 9967 71 29 42 44 0 8 0 amappl15 192 53 0 52 1 0 1 1 0 8 0 amappl14 184 275 0 259 2 1 1 2 0 8 0 amappl13 176 7 0 6 1 0 1 1 0 8 0 amappl12 168 796 0 791 1 0 1 1 0 8 0 amappl11 160 49 0 38 1 0 1 1 0 8 0 amappl10 152 68 0 56 1 0 1 1 0 8 0 amappl9 144 974 0 973 1 0 1 1 0 8 0 amappl8 136 288 0 221 3 0 3 3 0 8 0 amappl7 128 226 0 201 2 0 2 2 0 8 0 amappl6 120 326 0 310 2 1 1 2 0 8 0 amappl5 112 300 0 292 1 0 1 1 0 8 0 amappl4 104 801 0 775 2 1 1 2 0 8 0 amappl3 96 14311 0 14269 2 0 2 2 0 8 0 amappl2 88 6050 0 5978 3 1 2 3 0 8 0 amappl1 80 119320 0 118681 28 11 17 26 0 8 0 amappl 88 32278 0 32126 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 138 0 8 3 0 3 3 0 8 0 uaddrrnd 24 5336 0 5312 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 5336 0 5312 1 0 1 1 0 8 0 vmmpekpl 168 45129 0 45083 3 0 3 3 0 8 0 vmmpepl 168 499079 0 496720 265 124 141 153 0 357 15 vmsppl 344 5335 0 5312 3 0 3 3 0 8 0 rwobjpl 24 130340 0 122657 49 0 49 49 0 8 0 pdppl 4096 10678 0 10624 384 322 62 66 0 8 8 pvpl 32 2098009 0 2078318 392 196 196 359 0 265 0 pmappl 216 5335 0 5312 2 0 2 2 0 8 0 extentpl 40 56 0 38 1 0 1 1 0 8 0 phpool 112 1657 0 883 24 0 24 24 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(ffff800000dd8000) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff800029a24370) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff8000fffe9b68,ffff800029a24480,ffff800029a244d0) at sys_ioctl+0x49e syscall(ffff800029a24550) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffcb6d0, 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(ffff800000dd8000) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff800029a24370) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff8000fffe9b68,ffff800029a24480,ffff800029a244d0) at sys_ioctl+0x49e syscall(ffff800029a24550) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffcb6d0, count: -8