panic: kernel diagnostic assertion "sc->sc_dev == 0" failed: file "/syzkaller/managers/multicore/kernel/sys/net/if_tun.c", line 315 Stopped at db_enter+0x18: addq $0x8,%rsp TID PID UID PRFLAGS PFLAGS CPU COMMAND *125804 70545 0 0 0x4000000 0K syz-executor.5 db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82751deb) at panic+0x177 sys/kern/subr_prf.c:198 __assert(ffffffff827cd2be,ffffffff82818b32,13b,ffffffff827e01fc) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000d5c800) at tun_clone_destroy+0x278 sys/net/if_tun.c:315 if_clone_destroy(ffff80002c9c79b0) at if_clone_destroy+0x132 sys/net/if.c:1247 ifioctl(fffffd80646c7bc0,80206979,ffff80002c9c79b0,ffff8000212f15f0) at ifioctl+0x3b4 sys/net/if.c:1924 sys_ioctl(ffff8000212f15f0,ffff80002c9c7ac8,ffff80002c9c7b10) at sys_ioctl+0x4a2 syscall(ffff80002c9c7b90) at syscall+0x606 mi_syscall sys/sys/syscall_mi.h:110 [inline] syscall(ffff80002c9c7b90) at syscall+0x606 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xde94b0caaf0, count: 6 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{0}> ddb{0}> set $lines = 0 ddb{0}> set $maxwidth = 0 ddb{0}> show panic *cpu0: kernel diagnostic assertion "sc->sc_dev == 0" failed: file "/syzkaller/managers/multicore/kernel/sys/net/if_tun.c", line 315 ddb{0}> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82751deb) at panic+0x177 sys/kern/subr_prf.c:198 __assert(ffffffff827cd2be,ffffffff82818b32,13b,ffffffff827e01fc) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000d5c800) at tun_clone_destroy+0x278 sys/net/if_tun.c:315 if_clone_destroy(ffff80002c9c79b0) at if_clone_destroy+0x132 sys/net/if.c:1247 ifioctl(fffffd80646c7bc0,80206979,ffff80002c9c79b0,ffff8000212f15f0) at ifioctl+0x3b4 sys/net/if.c:1924 sys_ioctl(ffff8000212f15f0,ffff80002c9c7ac8,ffff80002c9c7b10) at sys_ioctl+0x4a2 syscall(ffff80002c9c7b90) at syscall+0x606 mi_syscall sys/sys/syscall_mi.h:110 [inline] syscall(ffff80002c9c7b90) at syscall+0x606 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xde94b0caaf0, count: -9 ddb{0}> show registers rdi 0 rsi 0x1 rbp 0xffff80002c9c7760 rbx 0xffffffff82b25b8f cpu_info_full_primary+0x2b8f rdx 0 rcx 0 rax 0xffff8000212f15f0 r8 0 r9 0x8080808080808080 r10 0x3310d670096413df r11 0x31ee6f21b6e7bc7d r12 0xffffffff82b25990 cpu_info_full_primary+0x2990 r13 0 r14 0 r15 0x1 rip 0xffffffff81b420b8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff80002c9c7750 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.5) pid=125804 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=82, nice=20 forw=0xffffffffffffffff, list=0xffff8000212f18a8,0xffff800021209610 process=0xffff8000212a65c8 user=0xffff80002c9c2000, vmspace=0xfffffd806b9f36f8 estcpu=36, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 70545 278343 53376 0 2 0 syz-executor.5 *70545 125804 53376 0 7 0x4000000 syz-executor.5 70545 44290 53376 0 3 0x4000080 fsleep syz-executor.5 90900 342799 98483 0 2 0 syz-executor.1 90900 202907 98483 0 3 0x4000080 fsleep syz-executor.1 90900 467680 98483 0 3 0x4000080 fsleep syz-executor.1 90940 137709 98929 0 2 0 syz-executor.7 90940 92838 98929 0 3 0x4000080 fsleep syz-executor.7 90940 427302 98929 0 3 0x4000080 fsleep syz-executor.7 66381 459712 16933 0 2 0 syz-executor.2 66381 126561 16933 0 3 0x4000080 fsleep syz-executor.2 52665 102517 91244 0 2 0x480 syz-executor.3 52665 262018 91244 0 3 0x4000080 kqpoll syz-executor.3 52665 308848 91244 0 3 0x4000080 fsleep syz-executor.3 98929 377009 17637 0 3 0x82 nanoslp syz-executor.7 49957 228179 17637 0 2 0x482 syz-executor.6 23193 340895 17637 0 2 0x2 syz-executor.4 53376 377064 17637 0 3 0x82 nanoslp syz-executor.5 49314 6847 1 0 3 0x100083 ttyin getty 16933 419045 17637 0 3 0x82 nanoslp syz-executor.2 77818 294370 17637 0 3 0x82 piperd syz-executor.0 23729 382865 0 0 3 0x14200 acct acct 98483 193576 17637 0 3 0x82 nanoslp syz-executor.1 91244 128519 17637 0 3 0x82 nanoslp syz-executor.3 24167 238514 0 0 3 0x14200 bored sosplice 17637 422540 84933 0 3 0x82 thrsleep syz-fuzzer 17637 93275 84933 0 3 0x4000082 nanoslp syz-fuzzer 17637 376012 84933 0 3 0x4000082 kqread syz-fuzzer 17637 291231 84933 0 3 0x4000082 thrsleep syz-fuzzer 17637 95097 84933 0 3 0x4000082 thrsleep syz-fuzzer 17637 106649 84933 0 3 0x4000082 wait syz-fuzzer 17637 403535 84933 0 3 0x4000082 wait syz-fuzzer 17637 435404 84933 0 3 0x4000082 wait syz-fuzzer 17637 412030 84933 0 3 0x4000082 wait syz-fuzzer 17637 515010 84933 0 3 0x4000082 thrsleep syz-fuzzer 17637 193897 84933 0 3 0x4000082 thrsleep syz-fuzzer 17637 439171 84933 0 3 0x4000082 wait syz-fuzzer 17637 312537 84933 0 3 0x4000082 wait syz-fuzzer 17637 511747 84933 0 3 0x4000082 wait syz-fuzzer 17637 174903 84933 0 3 0x4000082 wait syz-fuzzer 17637 385844 84933 0 3 0x4000082 thrsleep syz-fuzzer 84933 306613 92217 0 3 0x10008a sigsusp ksh 92217 391797 49489 0 3 0x9a kqread sshd 49489 25458 1 0 3 0x88 kqread sshd 46551 392739 44304 74 3 0x1100092 bpf pflogd 44304 496967 1 0 3 0x80 netio pflogd 7851 266169 46325 73 3 0x1100090 kqread syslogd 46325 33551 1 0 3 0x100082 netio syslogd 17169 369911 1 0 3 0x100080 kqread resolvd 5996 371892 56856 77 2 0x100092 dhcpleased 82350 259153 56856 77 3 0x100092 kqread dhcpleased 56856 167767 1 0 3 0x80 kqread dhcpleased 63307 333915 0 0 2 0x14200 smr 15316 516138 0 0 2 0x14200 zerothread 47752 104578 0 0 3 0x14200 aiodoned aiodoned 16910 21617 0 0 3 0x14200 syncer update 88380 434973 0 0 3 0x14200 cleaner cleaner 18086 343773 0 0 3 0x14200 reaper reaper 32530 150729 0 0 3 0x14200 pgdaemon pagedaemon 28482 471846 0 0 3 0x14200 bored viomb 13547 140645 0 0 3 0x40014200 acpi0 acpi0 24402 146440 0 0 7 0x40014200 idle1 56269 397410 0 0 3 0x14200 bored softnet 21756 255569 0 0 3 0x14200 bored softnet 66618 219300 0 0 3 0x14200 bored softnet 69916 13934 0 0 3 0x14200 bored softnet 14944 333071 0 0 3 0x14200 bored systqmp 44121 15266 0 0 3 0x14200 bored systq 56836 281422 0 0 3 0x40014200 bored softclock 36347 95360 0 0 3 0x40014200 idle0 1 397949 0 0 3 0x80082 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 10266 6584K 7181K 78643K 32696 0 pcb 78 20K 23K 78643K 4104 0 rtable 237 17K 18K 78643K 3677 0 ifaddr 91 28K 30K 78643K 1155 0 sysctl 3 1K 2K 78643K 12 0 counters 64 36K 37K 78643K 720 0 ioctlops 0 0K 4K 78643K 12362 0 iov 0 0K 40K 78643K 1879 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 4 0 vnodes 1639 102K 103K 78643K 13575 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 9K 78643K 344 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 0K 78643K 3852 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 15 53K 81K 78643K 13940 0 sigio 1 0K 0K 78643K 832 0 proc 71 91K 116K 78643K 2675 0 subproc 104 6K 7K 78643K 858 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 969 0 in_multi 82 5K 6K 78643K 1424 0 ether_multi 1 0K 0K 78643K 77 0 mrt 1 0K 0K 78643K 64 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 259 1155K 1155K 78643K 259 0 exec 0 0K 1K 78643K 2942 0 pfkey data 0 0K 0K 78643K 18 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 401 88K 103K 78643K 95310 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 609 0 NDP 16 0K 2K 78643K 449 0 temp 143 5778K 6803K 78643K 141457 0 kqueue 12 18K 26K 78643K 1153 0 SYN cache 2 16K 16K 78643K 2 0 ddb{0}> show all pools Name Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle plcache 128 22 0 0 1 0 1 1 0 8 0 rtpcb 120 993 0 990 10 9 1 3 0 8 0 rtentry 112 1253 0 1155 5 1 4 4 0 8 0 unpcb 144 18760 0 18743 152 144 8 13 0 8 7 syncache 296 70 0 70 19 19 0 1 0 8 0 tcpqe 32 393 0 393 12 12 0 3 0 8 0 tcpcb 776 4064 0 4059 127 126 1 14 0 8 0 arp 120 155 0 136 1 0 1 1 0 8 0 inpcb 368 14566 0 14490 272 265 7 17 0 8 0 nd6 48 288 0 268 1 0 1 1 0 8 0 pkpcb 40 35 0 35 11 11 0 1 0 8 0 kcovpl 48 66 0 58 1 0 1 1 0 8 0 mppekey 1024 7 0 7 3 3 0 1 0 8 0 ppxss 1256 179 0 178 19 18 1 1 0 8 0 pppxif 1456 36 0 36 12 12 0 1 0 8 0 pfstscr 40 29 0 29 5 5 0 1 0 8 0 pffrag 232 111 0 111 9 9 0 1 0 482 0 pffrnode 88 111 0 111 9 9 0 1 0 8 0 pffrent 40 301 0 301 10 10 0 1 0 8 0 pfosfp 40 1431 0 1007 5 0 5 5 0 8 0 pfosfpen 112 1431 0 716 21 0 21 21 0 8 0 pfanchor 1280 554 171 42 45 2 43 43 0 8 0 pfqueue 264 3 0 3 2 2 0 1 0 8 0 pfstitem 24 174 0 172 1 0 1 1 0 8 0 pfstkey 128 217 0 215 2 1 1 2 0 8 0 pfstate 384 191 0 189 6 5 1 5 0 8 0 pfrule 1344 21 0 20 2 1 1 2 0 8 0 rttmr 136 7 0 7 2 2 0 1 0 8 0 art_heap8 4096 7 0 6 5 4 1 3 0 8 0 art_heap4 256 5938 0 5560 63 36 27 29 0 8 0 art_table 32 5945 0 5566 9 5 4 4 0 8 0 art_node 16 1234 0 1149 1 0 1 1 0 8 0 sysvmsgpl 40 54 0 14 1 0 1 1 0 8 0 semapl 112 3846 0 3836 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 20091 0 18597 94 0 94 94 0 8 0 ffsino 272 20091 0 18597 101 0 101 101 0 8 0 nchpl 144 39059 0 37413 63 0 63 63 0 8 0 rtmask 32 2 0 2 1 1 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 151759 0 151759 14 12 2 2 0 8 2 percpumem 16 373 0 328 1 0 1 1 0 8 0 vmpool 696 26 0 26 7 7 0 1 0 8 0 kstatmem 264 462 0 430 13 10 3 3 0 8 0 scsiplug 72 7 0 7 2 2 0 1 0 8 0 scxspl 216 111946 0 111946 37 36 1 8 0 8 1 plimitpl 152 1841 0 1825 1 0 1 1 0 8 0 sigapl 424 14449 0 14401 10 2 8 8 0 8 0 futexpl 64 137732 0 137725 5 4 1 1 0 8 0 knotepl 120 987 0 0 15 0 15 15 0 8 0 kqueuepl 216 3162 0 3153 51 50 1 5 0 8 0 pipepl 320 3943 0 3914 107 99 8 9 0 8 5 fdescpl 496 14117 0 14089 8 4 4 5 0 8 0 filepl 152 117270 0 116958 214 195 19 24 0 8 6 lockfpl 104 17505 0 17503 11 10 1 2 0 8 0 lockfspl 48 2544 0 2542 1 0 1 1 0 8 0 sessionpl 144 85 0 68 1 0 1 1 0 8 0 pgrppl 48 204 0 187 1 0 1 1 0 8 0 ucredpl 104 11761 0 11746 1 0 1 1 0 8 0 zombiepl 144 14402 0 14401 9 8 1 1 0 8 0 processpl 1072 14449 0 14401 5 0 5 5 0 8 0 procpl 696 38471 0 38399 14 4 10 11 0 8 0 srpgc 96 88 0 88 26 26 0 1 0 8 0 sosppl 168 182 0 182 27 27 0 1 0 8 0 sockpl 488 34370 0 34268 810 796 14 46 0 8 1 mcl64k 65536 25 0 0 3 0 3 3 0 8 0 mcl16k 16384 32 0 0 3 0 3 3 0 8 0 mcl12k 12288 25 0 0 2 0 2 2 0 8 0 mcl9k 9216 23 0 0 2 0 2 2 0 8 0 mcl8k 8192 51 0 0 5 2 3 3 0 8 0 mcl4k 4096 35 0 0 4 1 3 3 0 8 0 mcl2k2 2112 16 0 0 2 0 2 2 0 8 0 mcl2k 2048 521 0 0 54 17 37 54 0 8 0 mtagpl 96 971 0 0 12 0 12 12 0 8 0 mbufpl 256 1972 0 0 83 0 83 83 0 8 0 bufpl 288 24376 0 18051 452 0 452 452 0 8 0 anonpl 24 2767306 0 2750124 210 82 128 138 0 186 0 amapchunkpl 152 270355 0 269593 75 38 37 45 0 158 0 amappl16 200 24954 0 24373 162 126 36 44 0 8 0 amappl15 192 4 0 4 2 2 0 1 0 8 0 amappl14 184 351 0 331 3 1 2 2 0 8 0 amappl13 176 9 0 8 1 0 1 1 0 8 0 amappl12 168 1149 0 1141 1 0 1 1 0 8 0 amappl11 160 51 0 37 1 0 1 1 0 8 0 amappl10 152 110 0 93 1 0 1 1 0 8 0 amappl9 144 1011 0 1010 1 0 1 1 0 8 0 amappl8 136 861 0 714 6 0 6 6 0 8 0 amappl7 128 321 0 293 2 0 2 2 0 8 0 amappl6 120 488 0 467 2 1 1 2 0 8 0 amappl5 112 547 0 536 1 0 1 1 0 8 0 amappl4 104 1341 0 1301 2 0 2 2 0 8 0 amappl3 96 41399 0 41337 2 0 2 2 0 8 0 amappl2 88 15510 0 15429 3 1 2 3 0 8 0 amappl1 80 321318 0 320531 28 10 18 28 0 8 0 amappl 88 93952 0 93740 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 133 0 3 3 0 3 3 0 8 0 uaddrrnd 24 14143 0 14115 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 14143 0 14115 1 0 1 1 0 8 0 vmmpekpl 168 117123 0 117050 4 0 4 4 0 8 0 vmmpepl 168 1306661 0 1303680 534 379 155 173 0 357 5 vmsppl 440 14142 0 14115 5 1 4 4 0 8 0 rwobjpl 56 341771 0 333801 128 13 115 117 0 8 0 pdppl 4096 28293 0 28230 961 892 69 79 0 8 6 pvpl 32 5471741 0 5448660 566 346 220 365 0 265 0 pmappl 248 14142 0 14115 3 0 3 3 0 8 0 extentpl 40 56 0 38 1 0 1 1 0 8 0 phpool 112 2142 0 1252 26 0 26 26 0 8 0 ddb{0}> machine ddbcpu 0 Invalid cpu 0 ddb{0}> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82751deb) at panic+0x177 sys/kern/subr_prf.c:198 __assert(ffffffff827cd2be,ffffffff82818b32,13b,ffffffff827e01fc) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000d5c800) at tun_clone_destroy+0x278 sys/net/if_tun.c:315 if_clone_destroy(ffff80002c9c79b0) at if_clone_destroy+0x132 sys/net/if.c:1247 ifioctl(fffffd80646c7bc0,80206979,ffff80002c9c79b0,ffff8000212f15f0) at ifioctl+0x3b4 sys/net/if.c:1924 sys_ioctl(ffff8000212f15f0,ffff80002c9c7ac8,ffff80002c9c7b10) at sys_ioctl+0x4a2 syscall(ffff80002c9c7b90) at syscall+0x606 mi_syscall sys/sys/syscall_mi.h:110 [inline] syscall(ffff80002c9c7b90) at syscall+0x606 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xde94b0caaf0, count: -9 ddb{0}> machine ddbcpu 1 Stopped at x86_ipi_db+0x1a: addq $0x8,%rsp x86_ipi_db(ffff800020d68ff0) at x86_ipi_db+0x1a sys/arch/amd64/amd64/db_interface.c:393 x86_ipi_handler() at x86_ipi_handler+0xb7 sys/arch/amd64/amd64/ipi.c:106 Xresume_lapic_ipi() at Xresume_lapic_ipi+0x23 acpicpu_idle() at acpicpu_idle+0x312 sys/dev/acpi/acpicpu.c:1206 sched_idle(ffff800020d68ff0) at sched_idle+0x417 sys/kern/kern_sched.c:175 end trace frame: 0x0, count: 10 ddb{1}> trace x86_ipi_db(ffff800020d68ff0) at x86_ipi_db+0x1a sys/arch/amd64/amd64/db_interface.c:393 x86_ipi_handler() at x86_ipi_handler+0xb7 sys/arch/amd64/amd64/ipi.c:106 Xresume_lapic_ipi() at Xresume_lapic_ipi+0x23 acpicpu_idle() at acpicpu_idle+0x312 sys/dev/acpi/acpicpu.c:1206 sched_idle(ffff800020d68ff0) at sched_idle+0x417 sys/kern/kern_sched.c:175 end trace frame: 0x0, count: -5