panic: kernel diagnostic assertion "sc->sc_dev == 0" failed: file "/syzkaller/managers/main/kernel/sys/net/if_tun.c", line 305 Stopped at db_enter+0x18: addq $0x8,%rsp TID PID UID PRFLAGS PFLAGS CPU COMMAND *153083 9192 0 0 0x4000000 0 syz-executor.6 db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82567337) at panic+0x161 sys/kern/subr_prf.c:202 __assert(ffffffff825de3ac,ffffffff826127f3,131,ffffffff825f46c6) at __assert+0x25 sys/kern/subr_prf.c:161 tun_clone_destroy(ffff800000bfc800) at tun_clone_destroy+0x234 sys/net/if_tun.c:305 if_clone_destroy(ffff8000263591a0) at if_clone_destroy+0x132 sys/net/if.c:1218 sys_ioctl(ffff8000215ead20,ffff8000263592b8,ffff800026359310) at sys_ioctl+0x49e syscall(ffff800026359380) at syscall+0x44e sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xb0d6ab480f0, 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 305 ddb> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82567337) at panic+0x161 sys/kern/subr_prf.c:202 __assert(ffffffff825de3ac,ffffffff826127f3,131,ffffffff825f46c6) at __assert+0x25 sys/kern/subr_prf.c:161 tun_clone_destroy(ffff800000bfc800) at tun_clone_destroy+0x234 sys/net/if_tun.c:305 if_clone_destroy(ffff8000263591a0) at if_clone_destroy+0x132 sys/net/if.c:1218 sys_ioctl(ffff8000215ead20,ffff8000263592b8,ffff800026359310) at sys_ioctl+0x49e syscall(ffff800026359380) at syscall+0x44e sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xb0d6ab480f0, count: -8 ddb> show registers rdi 0 rsi 0x1 rbp 0xffff800026359030 rbx 0x80206979 __kernel_virt_to_phys+0x206979 rdx 0xffff800000beb640 rcx 0 rax 0xffff8000215ead20 r8 0 r9 0x8080808080808080 r10 0x397af52e3999909d r11 0xfe24e74cc331663f r12 0 r13 0 r14 0 r15 0x1 rip 0xffffffff818bd128 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800026359020 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb> show proc PROC (syz-executor.6) pid=153083 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=83, nice=20 forw=0xffffffffffffffff, list=0xffff80002165c540,0xffff8000215ea550 process=0xffff800029936428 user=0xffff800026354000, vmspace=0xfffffd8067f9e118 estcpu=33, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb> ps PID TID PPID UID S FLAGS WAIT COMMAND 98605 331478 79626 0 2 0 syz-executor.2 98605 134698 79626 0 3 0x4000080 fsleep syz-executor.2 29852 368971 70721 0 2 0 syz-executor.3 29852 369782 70721 0 3 0x4000080 fsleep syz-executor.3 85132 150565 47139 0 2 0 syz-executor.5 85132 190950 47139 0 3 0x4000080 fsleep syz-executor.5 9192 481893 18615 0 2 0 syz-executor.6 * 9192 153083 18615 0 7 0x4000000 syz-executor.6 67472 240652 24553 0 2 0 syz-executor.0 67472 295783 24553 0 3 0x4000080 fsleep syz-executor.0 37055 197008 705 0 3 0x80 nanoslp syz-executor.7 37055 164239 705 0 3 0x4000080 pipewr syz-executor.7 37055 185038 705 0 3 0x4000080 pipewr syz-executor.7 37055 509911 705 0 3 0x4000080 fsleep syz-executor.7 70721 476041 40874 0 3 0x82 nanoslp syz-executor.3 79626 104300 40874 0 3 0x82 nanoslp syz-executor.2 24553 346472 40874 0 3 0x82 nanoslp syz-executor.0 18615 352353 40874 0 3 0x82 nanoslp syz-executor.6 3085 139981 40874 0 3 0x82 nanoslp syz-executor.4 705 382937 40874 0 2 0x482 syz-executor.7 33461 262386 40874 0 3 0x82 nanoslp syz-executor.1 47139 67626 40874 0 3 0x82 nanoslp syz-executor.5 86762 238802 1 0 3 0x100083 ttyin getty 27512 381359 0 0 3 0x14280 nfsidl nfsio 90083 488683 0 0 3 0x14280 nfsidl nfsio 97396 356987 0 0 3 0x14280 nfsidl nfsio 82113 302855 0 0 3 0x14280 nfsidl nfsio 60297 225444 0 0 3 0x14280 nfsidl nfsio 81260 61608 0 0 3 0x14280 nfsidl nfsio 96965 173518 0 0 3 0x14280 nfsidl nfsio 98653 519754 0 0 3 0x14280 nfsidl nfsio 66490 399954 0 0 3 0x14280 nfsidl nfsio 94036 218494 0 0 3 0x14280 nfsidl nfsio 89890 32839 0 0 3 0x14280 nfsidl nfsio 64681 17557 0 0 3 0x14280 nfsidl nfsio 35652 195317 0 0 3 0x14280 nfsidl nfsio 66871 102629 0 0 3 0x14280 nfsidl nfsio 11922 16466 0 0 3 0x14280 nfsidl nfsio 44537 494706 0 0 3 0x14280 nfsidl nfsio 25979 380302 0 0 3 0x14280 nfsidl nfsio 2924 509954 0 0 3 0x14280 nfsidl nfsio 91487 330558 0 0 3 0x14280 nfsidl nfsio 12809 418655 0 0 3 0x14280 nfsidl nfsio 33876 441595 0 0 3 0x14200 bored sosplice 40874 319992 93231 0 3 0x82 thrsleep syz-fuzzer 40874 109807 93231 0 3 0x4000082 thrsleep syz-fuzzer 40874 480536 93231 0 3 0x4000082 thrsleep syz-fuzzer 40874 71987 93231 0 3 0x4000082 kqread syz-fuzzer 40874 222628 93231 0 3 0x4000082 thrsleep syz-fuzzer 40874 12946 93231 0 3 0x4000082 thrsleep syz-fuzzer 40874 337180 93231 0 3 0x4000082 thrsleep syz-fuzzer 40874 336771 93231 0 3 0x4000082 thrsleep syz-fuzzer 93231 429380 23268 0 3 0x10008a sigsusp ksh 23268 271964 49296 0 3 0x9a kqread sshd 49296 399399 1 0 3 0x88 kqread sshd 21410 247450 79816 73 3 0x1100090 kqread syslogd 79816 180928 1 0 3 0x100082 netio syslogd 59348 28177 1 0 3 0x100080 kqread resolvd 69412 298504 7153 77 2 0x100092 dhcpleased 51867 321636 7153 77 3 0x100092 kqread dhcpleased 7153 26002 1 0 3 0x80 kqread dhcpleased 745 98575 0 0 3 0x14200 bored smr 15790 374816 0 0 2 0x14200 zerothread 5914 400588 0 0 3 0x14200 aiodoned aiodoned 9801 77313 0 0 3 0x14200 syncer update 30856 472501 0 0 3 0x14200 cleaner cleaner 74194 324834 0 0 3 0x14200 reaper reaper 7779 371805 0 0 3 0x14200 pgdaemon pagedaemon 75371 368668 0 0 3 0x14200 bored viomb 22773 187094 0 0 3 0x40014200 acpi0 acpi0 69176 147654 0 0 3 0x14200 bored softnet 51248 337950 0 0 3 0x14200 bored systqmp 39500 47475 0 0 3 0x14200 bored systq 97374 400295 0 0 3 0x40014200 bored softclock 97009 224712 0 0 3 0x40014200 idle0 1 491766 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 10201 6471K 7318K 78643K 38068 0 pcb 13 16K 18K 78643K 1527 0 rtable 199 6K 15K 78643K 5155 0 ifaddr 101 25K 27K 78643K 2506 0 sysctl 3 1K 1K 78643K 3 0 counters 28 17K 17K 78643K 243 0 ioctlops 0 0K 4K 78643K 8225 0 iov 0 0K 24K 78643K 2112 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 5 0 vnodes 1362 85K 86K 78643K 9806 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 9K 78643K 131 0 VM map 2 0K 0K 78643K 2 0 sem 11 1K 1K 78643K 11 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 16 57K 82K 78643K 21191 0 sigio 0 0K 0K 78643K 226 0 proc 67 59K 84K 78643K 2649 0 subproc 104 6K 6K 78643K 899 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 1077 0 in_multi 79 5K 7K 78643K 2860 0 ether_multi 1 0K 0K 78643K 101 0 mrt 2 0K 0K 78643K 17 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 253 1129K 1129K 78643K 253 0 exec 0 0K 2K 78643K 4172 0 pfkey data 0 0K 1K 78643K 9 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 7 26K 26K 78643K 7 0 UVM amap 539 1044K 1285K 78643K 124662 0 UVM aobj 135 9K 9K 78643K 140 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 490 0 NDP 12 0K 2K 78643K 803 0 temp 262 4988K 5052K 78643K 161851 0 kqueue 12 18K 33K 78643K 1650 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 1186 0 1183 18 17 1 3 0 8 0 rtentry 112 1020 0 930 4 0 4 4 0 8 0 unpcb 136 13693 0 13676 122 119 3 9 0 8 2 syncache 296 28 0 28 4 4 0 1 0 8 0 sackhl 24 1 0 1 1 1 0 1 0 8 0 tcpqe 32 4 0 4 2 2 0 1 0 8 0 tcpcb 736 5388 0 5384 211 210 1 20 0 8 0 arp 88 152 0 136 1 0 1 1 0 8 0 ipq 40 8 0 8 4 3 1 1 0 8 1 ipqe 40 21 0 21 4 3 1 1 0 8 1 inpcb 312 15390 0 15381 272 270 2 19 0 8 1 ip6q 72 2 0 2 1 1 0 1 0 8 0 ip6af 40 3 0 3 1 1 0 1 0 8 0 nd6 48 237 0 216 1 0 1 1 0 8 0 pkpcb 40 72 0 72 10 10 0 1 0 8 0 kcovpl 48 69 0 61 1 0 1 1 0 8 0 ppxss 1152 105 0 105 21 21 0 1 0 8 0 pfstscr 40 69 0 52 2 1 1 1 0 8 0 pffrag 232 141 0 140 8 7 1 1 0 482 0 pffrnode 88 141 0 140 8 7 1 1 0 8 0 pffrent 40 332 0 331 10 9 1 1 0 8 0 pfosfp 40 7 0 7 1 0 1 1 0 8 1 pfosfpen 112 7 0 7 1 0 1 1 0 8 1 pfrktable 1344 997 0 997 15 15 0 2 0 8 0 pftag 88 33 0 22 1 0 1 1 0 8 0 pfqueue 264 2 0 2 2 2 0 1 0 8 0 pfstitem 24 39 0 8 1 0 1 1 0 8 0 pfstkey 112 91 0 80 2 1 1 1 0 8 0 pfstate 336 58 0 42 3 1 2 2 0 8 0 pfrule 1360 1899 0 1895 27 26 1 21 0 8 0 rttmrq 48 37 0 33 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 5079 0 4732 61 38 23 31 0 8 0 art_table 32 5080 0 4732 6 3 3 4 0 8 0 art_node 16 1011 0 934 1 0 1 1 0 8 0 sysvmsgpl 40 7 0 2 1 0 1 1 0 8 0 semupl 112 1 0 1 1 1 0 1 0 8 0 semapl 112 9 0 0 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 26960 0 25477 94 0 94 94 0 8 0 ffsino 240 26960 0 25477 88 0 88 88 0 8 0 nchpl 144 53184 0 51539 63 0 63 63 0 8 0 uvmvnodes 80 6242 0 0 128 0 128 128 0 8 0 vnodes 224 6242 0 0 368 0 368 368 0 8 0 namei 1024 168533 0 168533 17 16 1 2 0 8 1 vcpupl 1984 384 0 0 48 0 48 48 0 8 0 vmpool 528 435 0 51 28 2 26 26 0 8 0 pfiaddrpl 120 314 0 314 6 6 0 1 0 8 0 kstatmem 264 454 0 430 5 3 2 3 0 8 0 scsiplug 72 13 0 13 4 4 0 1 0 8 0 scxspl 216 169332 0 169332 37 36 1 8 0 8 1 plimitpl 152 1450 0 1436 1 0 1 1 0 8 0 sigapl 424 21355 0 21292 8 0 8 8 0 8 0 futexpl 64 176611 0 176606 9 8 1 1 0 8 0 knotepl 120 611666 0 611586 96 93 3 15 0 8 0 kqueuepl 184 3429 0 3421 36 35 1 6 0 8 0 pipepl 304 21441 0 21412 268 264 4 18 0 8 0 fdescpl 432 21320 0 21293 5 1 4 4 0 8 0 filepl 120 146223 0 145980 233 223 10 25 0 8 1 lockfpl 104 3343 0 3341 7 6 1 3 0 8 0 lockfspl 48 1112 0 1110 2 1 1 2 0 8 0 sessionpl 144 89 0 73 1 0 1 1 0 8 0 pgrppl 48 196 0 180 1 0 1 1 0 8 0 ucredpl 96 11827 0 11817 1 0 1 1 0 8 0 zombiepl 144 21294 0 21292 3 2 1 1 0 8 0 processpl 1000 21355 0 21292 9 0 9 9 0 8 0 procpl 672 61415 0 61337 56 48 8 10 0 8 1 sosppl 168 53 0 53 14 14 0 1 0 8 0 sockpl 448 30351 0 30322 558 547 11 30 0 8 7 mcl64k 65536 612 0 612 52 51 1 1 0 8 1 mcl16k 16384 219 0 219 47 46 1 1 0 8 1 mcl12k 12288 620 0 620 54 54 0 1 0 8 0 mcl9k 9216 239 0 239 54 53 1 1 0 8 1 mcl8k 8192 1347 0 1347 42 41 1 1 0 8 1 mcl4k 4096 2205 0 2205 21 20 1 1 0 8 1 mcl2k2 2112 159 0 159 53 52 1 1 0 8 1 mcl2k 2048 118030 0 117981 33 25 8 11 0 8 0 mtagpl 96 3770 0 3661 43 40 3 23 0 8 0 mbufpl 256 315909 0 315617 462 437 25 322 0 8 3 bufpl 288 35699 0 29294 458 0 458 458 0 8 0 anonpl 24 4205165 0 4183767 361 225 136 160 0 188 0 amapchunkpl 152 402151 0 401311 780 746 34 659 0 158 0 amappl16 200 57275 0 56537 203 163 40 52 0 8 0 amappl15 192 3943 0 3938 2 1 1 1 0 8 0 amappl14 184 2226 0 2222 1 0 1 1 0 8 0 amappl13 176 1365 0 1363 1 0 1 1 0 8 0 amappl12 168 4641 0 4639 3 2 1 1 0 8 0 amappl11 160 5271 0 5251 1 0 1 1 0 8 0 amappl10 152 3308 0 3303 1 0 1 1 0 8 0 amappl9 144 1061 0 1055 1 0 1 1 0 8 0 amappl8 136 4026 0 3875 7 1 6 6 0 8 0 amappl7 128 2413 0 2403 1 0 1 1 0 8 0 amappl6 120 1166 0 1141 2 0 2 2 0 8 0 amappl5 112 16480 0 16459 1 0 1 1 0 8 0 amappl4 104 11683 0 11644 4 2 2 2 0 8 0 amappl3 96 68503 0 68451 2 0 2 2 0 8 0 amappl2 88 26151 0 26082 3 1 2 3 0 8 0 amappl1 80 513093 0 512453 25 10 15 19 0 8 1 amappl 88 122827 0 122582 6 0 6 6 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 5 3 0 3 3 0 8 0 uaddrrnd 24 21755 0 21344 3 0 3 3 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 21755 0 21344 3 0 3 3 0 8 0 vmmpekpl 168 237727 0 237630 5 0 5 5 0 8 0 vmmpepl 168 2093046 0 2089503 601 438 163 192 0 357 1 vmsppl 272 21754 0 21344 29 1 28 28 0 8 0 rwobjpl 24 517567 0 509294 56 5 51 51 0 8 0 pdppl 4096 43516 0 43072 1430 982 448 448 0 8 4 pvpl 32 7999194 0 7976046 676 469 207 259 0 265 6 pmappl 216 21754 0 21344 23 0 23 23 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 3912 0 2713 41 6 35 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(ffffffff82567337) at panic+0x161 sys/kern/subr_prf.c:202 __assert(ffffffff825de3ac,ffffffff826127f3,131,ffffffff825f46c6) at __assert+0x25 sys/kern/subr_prf.c:161 tun_clone_destroy(ffff800000bfc800) at tun_clone_destroy+0x234 sys/net/if_tun.c:305 if_clone_destroy(ffff8000263591a0) at if_clone_destroy+0x132 sys/net/if.c:1218 sys_ioctl(ffff8000215ead20,ffff8000263592b8,ffff800026359310) at sys_ioctl+0x49e syscall(ffff800026359380) at syscall+0x44e sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xb0d6ab480f0, 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(ffffffff82567337) at panic+0x161 sys/kern/subr_prf.c:202 __assert(ffffffff825de3ac,ffffffff826127f3,131,ffffffff825f46c6) at __assert+0x25 sys/kern/subr_prf.c:161 tun_clone_destroy(ffff800000bfc800) at tun_clone_destroy+0x234 sys/net/if_tun.c:305 if_clone_destroy(ffff8000263591a0) at if_clone_destroy+0x132 sys/net/if.c:1218 sys_ioctl(ffff8000215ead20,ffff8000263592b8,ffff800026359310) at sys_ioctl+0x49e syscall(ffff800026359380) at syscall+0x44e sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xb0d6ab480f0, count: -8