panic: kernel diagnostic assertion "sc->sc_dev == 0" failed: file "/syzkaller/managers/multicore/kernel/sys/net/if_tun.c", line 319 Stopped at db_enter+0x25: addq $0x8,%rsp TID PID UID PRFLAGS PFLAGS CPU COMMAND *339116 84826 0 0x2 0 0K ifconfig 498099 70945 0 0x10100002 0 1 sh db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:438 panic(ffffffff834eb340) at panic+0x1e5 sys/kern/subr_prf.c:198 __assert(ffffffff835286b3,ffffffff8356f46f,13f,ffffffff834632c1) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff80000160d000) at tun_clone_destroy+0x38a if_clone_destroy(ffff80002a32f0c0) at if_clone_destroy+0x205 sys/net/if.c:1464 ifioctl(ffff800010fc6948,80206979,ffff80002a32f0c0,ffff80002a247ca0) at ifioctl+0x59d sys/net/if.c:2145 sys_ioctl(ffff80002a247ca0,ffff80002a32f2a0,ffff80002a32f1f0) at sys_ioctl+0x674 sys/kern/sys_generic.c:-1 syscall(ffff80002a32f2a0) at syscall+0xbd4 mi_syscall sys/sys/syscall_mi.h:176 [inline] syscall(ffff80002a32f2a0) at syscall+0xbd4 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x718b21f8e330, 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 319 ddb{0}> show kasan No such command ddb{0}> trace db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:438 panic(ffffffff834eb340) at panic+0x1e5 sys/kern/subr_prf.c:198 __assert(ffffffff835286b3,ffffffff8356f46f,13f,ffffffff834632c1) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff80000160d000) at tun_clone_destroy+0x38a if_clone_destroy(ffff80002a32f0c0) at if_clone_destroy+0x205 sys/net/if.c:1464 ifioctl(ffff800010fc6948,80206979,ffff80002a32f0c0,ffff80002a247ca0) at ifioctl+0x59d sys/net/if.c:2145 sys_ioctl(ffff80002a247ca0,ffff80002a32f2a0,ffff80002a32f1f0) at sys_ioctl+0x674 sys/kern/sys_generic.c:-1 syscall(ffff80002a32f2a0) at syscall+0xbd4 mi_syscall sys/sys/syscall_mi.h:176 [inline] syscall(ffff80002a32f2a0) at syscall+0xbd4 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x718b21f8e330, count: -9 ddb{0}> show registers rdi 0 rsi 0x1 rbp 0xffff80002a32ee80 rbx 0xffffffff839c7e0f cpu_info_full_primary+0x2e0f rdx 0 rcx 0xffff80002a247ca0 rax 0xffffffff839c6ff0 cpu_info_full_primary+0x1ff0 r8 0x101010101010101 r9 0x8080808080808080 r10 0x2fca1ef39e5fa33f r11 0x7f80932dcd2da6d2 r12 0xffffffff839c7c10 cpu_info_full_primary+0x2c10 r13 0 r14 0 r15 0x1 rip 0xffffffff81033b45 db_enter+0x25 cs 0x8 rflags 0x246 rsp 0xffff80002a32ee70 ss 0x10 db_enter+0x25: addq $0x8,%rsp ddb{0}> show proc PROC (ifconfig) tid=339116 pid=84826 tcnt=1 stat=onproc flags process=2 proc=0 runpri=32, usrpri=86, slppri=32, nice=20 wchan=0x0, wmesg=, ps_single=0x0 scnt=0 ecnt=0 forw=0xffffffffffffffff, list=0xffff80002a247a08,0xffff80002a246a88 process=0xffff800045ff2200 user=0xffff80002a32a000, vmspace=0xfffff0007505b7b8 estcpu=36, cpticks=2, pctcpu=0.0, user=0, sys=1, intr=0 ddb{0}> ps PID TID PPID UID S PRLAGS PFLAGS WAIT COMMAND 95448 212399 67815 0 2 0 0 syz-executor 95448 236985 67815 0 2 0 0x4000000 syz-executor 95448 496545 67815 0 2 0 0x4000000 syz-executor 95448 347203 67815 0 2 0 0x4000000 syz-executor 72137 54807 23832 0 2 0 0 syz-executor 72137 352225 23832 0 3 0 0x4000080 fsleep syz-executor 21708 30084 72093 0 3 0x2 0 clonelk ifconfig 72093 172703 78063 0 3 0x100002 0x88 sigsusp sh *84826 339116 73368 0 7 0x2 0 ifconfig 73368 80743 30908 0 3 0x100002 0x88 sigsusp sh 30908 418206 83667 0 3 0x2 0x80 wait syz-executor 78063 323379 83667 0 3 0x2 0x80 wait syz-executor 32637 411496 85351 0 2 0x2 0 ifconfig 85351 470542 61159 0 3 0x100002 0x88 sigsusp sh 70945 498099 34279 0 7 0x10100002 0 sh 61159 42778 83667 0 3 0x2 0x80 wait syz-executor 34279 191604 83667 0 3 0x2 0x80 wait syz-executor 30801 194037 83667 0 2 0x2 0 syz-executor 86393 435354 83667 0 2 0x2 0 syz-executor 67815 493083 83667 0 2 0x2 0xc80 syz-executor 23832 455029 83667 0 3 0x2 0x80 nanoslp syz-executor 83667 375465 60293 0 3 0x2 0x80 kqread syz-executor 60293 271501 3436 0 3 0x100002 0x88 sigsusp ksh 3436 103832 96659 0 3 0x10 0x88 kqread sshd-session 96659 390975 71896 0 3 0x12 0x80 kqread sshd-session 46226 3566 1 0 3 0x100003 0x80 ttyin getty 71896 518221 1 0 3 0 0x88 kqread sshd 38162 185285 15729 74 3 0x1100012 0x80 bpf pflogd 15729 350715 1 0 3 0 0x80 sbwait pflogd 91892 376340 68765 73 3 0x1100010 0x80 kqread syslogd 68765 78943 1 0 3 0x100002 0x80 sbwait syslogd-parent 20133 393845 1 0 3 0x100000 0x80 kqread resolvd 46965 239022 66025 77 2 0x100012 0 dhcpleased 84883 54388 66025 77 3 0x100012 0x80 kqread dhcpleased 66025 69819 1 0 3 0 0x80 kqread dhcpleased 83032 224621 0 0 3 0x14000 0x200 bored smr 79116 400041 0 0 2 0x14000 0x200 zerothread 87798 390973 0 0 3 0x14000 0x200 aiodoned aiodoned 45167 340595 0 0 3 0x14000 0x200 syncer update 64676 220736 0 0 3 0x14000 0x200 cleaner cleaner 68716 324801 0 0 3 0x14000 0x200 reaper reaper 43411 506301 0 0 3 0x14000 0x200 pgdaemon pagedaemon 12266 398688 0 0 3 0x14000 0x200 bored viomb 56488 523074 0 0 3 0x14000 0x40000200 acpi0 acpi0 57295 150587 0 0 3 0x14000 0x40000200 idle1 31764 255272 0 0 3 0x14000 0x200 bored softnet1 20126 447773 0 0 2 0x14000 0x200 softnet0 17467 247928 0 0 3 0x14000 0x200 smrbar systqmp 35491 299659 0 0 3 0x14000 0x200 bored systq 50462 492406 0 0 3 0x14000 0x200 tmoslp softclockmp 25126 413476 0 0 3 0x14000 0x40000200 tmoslp softclock 76377 247287 0 0 3 0x14000 0x40000200 idle0 1 331881 0 0 3 0x2 0x80 wait init 0 0 -1 0 3 0x10000 0x200 scheduler swapper ddb{0}> show all locks Process 84826 (ifconfig) thread 0xffff80002a247ca0 (339116) exclusive rwlock clonelk r = 0 (0xffffffff8399adb8) #0 witness_lock+0x5f1 stacktrace_save sys/sys/stacktrace.h:37 [inline] #0 witness_lock+0x5f1 sys/kern/subr_witness.c:1160 #1 rw_do_enter_write+0x42c sys/kern/kern_rwlock.c:320 #2 if_clone_destroy+0x93 sys/net/if.c:-1 #3 ifioctl+0x59d sys/net/if.c:2145 #4 sys_ioctl+0x674 sys/kern/sys_generic.c:-1 #5 syscall+0xbd4 mi_syscall sys/sys/syscall_mi.h:176 [inline] #5 syscall+0xbd4 sys/arch/amd64/amd64/trap.c:791 #6 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 0 (0xffffffff83acdcc0) #0 witness_lock+0x5f1 stacktrace_save sys/sys/stacktrace.h:37 [inline] #0 witness_lock+0x5f1 sys/kern/subr_witness.c:1160 #1 __mp_acquire_count+0x58 sys/kern/kern_lock.c:-1 #2 sleep_finish+0x2d8 sys/kern/kern_synch.c:369 #3 rw_do_enter_write+0x1dc sys/kern/kern_rwlock.c:298 #4 if_clone_destroy+0x93 sys/net/if.c:-1 #5 ifioctl+0x59d sys/net/if.c:2145 #6 sys_ioctl+0x674 sys/kern/sys_generic.c:-1 #7 syscall+0xbd4 mi_syscall sys/sys/syscall_mi.h:176 [inline] #7 syscall+0xbd4 sys/arch/amd64/amd64/trap.c:791 #8 Xsyscall+0x128 Process 17467 (systqmp) thread 0xffff800045ffea60 (247928) shared rwlock systqmp r = 0 (0xffffffff8399ad18) #0 witness_lock+0x5f1 stacktrace_save sys/sys/stacktrace.h:37 [inline] #0 witness_lock+0x5f1 sys/kern/subr_witness.c:1160 #1 taskq_thread+0x11a sys/kern/kern_task.c:442 #2 proc_trampoline+0x10 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 11044 12077K 12147K 166960K 12206 0 pcb 17 14K 16K 166960K 116 0 rtable 131 3K 7K 166960K 661 0 pf 26 16K 20K 166960K 82 0 ifaddr 25 4K 7K 166960K 91 0 ifgroup 39 1K 2K 166960K 108 0 sysctl 1 1K 9K 166960K 6 0 counters 62 36K 37K 166960K 98 0 ioctlops 0 0K 4K 166960K 1526 0 iov 0 0K 12K 166960K 1 0 mount 1 1K 1K 166960K 1 0 log 0 0K 0K 166960K 4 0 vnodes 1287 81K 81K 166960K 1548 0 UFS quota 1 32K 32K 166960K 1 0 UFS mount 5 36K 36K 166960K 5 0 shm 2 1K 5K 166960K 4 0 VM map 2 1K 1K 166960K 2 0 sem 7 0K 0K 166960K 9 0 dirhash 12 2K 2K 166960K 18 0 ACPI 1734 201K 291K 166960K 11964 0 file desc 19 69K 97K 166960K 386 0 proc 93 164K 180K 166960K 891 0 subproc 72 4K 4K 166960K 207 0 NFS srvsock 1 0K 0K 166960K 1 0 NFS daemon 1 16K 16K 166960K 1 0 ip_moptions 0 0K 0K 166960K 6 0 in_multi 44 2K 6K 166960K 211 0 ether_multi 1 0K 0K 166960K 1 0 mrt 0 0K 0K 166960K 4 0 ISOFS mount 1 32K 32K 166960K 1 0 MSDOSFS mount 1 16K 16K 166960K 1 0 ttys 49 228K 228K 166960K 49 0 exec 0 0K 1K 166960K 537 0 fusefs mount 1 32K 32K 166960K 1 0 tdb 3 0K 0K 166960K 3 0 VM swap 8 62K 64K 166960K 10 0 UVM amap 206 170K 178K 166960K 4613 0 UVM aobj 6 2K 2K 166960K 7 0 pinsyscall 44 88K 108K 166960K 1802 0 memdesc 1 4K 4K 166960K 1 0 crypto data 1 1K 1K 166960K 1 0 NDP 10 0K 2K 166960K 62 0 temp 37 9122K 9186K 166960K 8588 0 kqueue 13 20K 24K 166960K 32 0 SYN cache 2 16K 16K 166960K 2 0 ddb{0}> show all pools Name Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle plcache 128 28 0 0 1 0 1 1 0 8 0 rtpcb 120 120 0 117 3 0 3 3 0 8 2 rtentry 176 225 0 168 6 0 6 6 0 8 0 unpcb 144 469 0 452 6 0 6 6 0 8 5 syncache 336 4 0 4 1 0 1 1 0 8 1 tcpcb 736 23 0 19 1 0 1 1 0 8 0 arp 136 39 0 31 1 0 1 1 0 8 0 inpcb 328 229 0 219 7 0 7 7 0 8 5 nd6 152 55 0 45 1 0 1 1 0 8 0 pkpcb 40 5 0 5 1 0 1 1 0 8 1 kcovpl 48 23 0 15 1 0 1 1 0 8 0 ppxss 1192 2 0 2 1 0 1 1 0 8 1 pffrag 232 10 0 1 1 0 1 1 0 482 0 pffrnode 88 7 0 1 1 0 1 1 0 8 0 pffrent 40 16 0 4 1 0 1 1 0 8 0 pfosfp 40 1428 0 1005 5 0 5 5 0 8 0 pfosfpen 112 1428 0 714 21 0 21 21 0 8 0 pfstitem 24 38 0 0 1 0 1 1 0 8 0 pfstkey 128 38 0 0 2 0 2 2 0 8 0 pfstate 448 38 0 0 5 0 5 5 0 8 0 pfrule 1360 24 0 19 2 1 1 2 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 905 0 623 29 0 29 29 0 8 8 art_table 40 906 0 623 5 0 5 5 0 8 0 art_node 32 225 0 173 1 0 1 1 0 8 0 semapl 72 7 0 2 1 0 1 1 0 8 0 shmpl 120 4 0 1 1 0 1 1 0 8 0 dirhash 1024 21 0 4 3 0 3 3 0 8 0 dino2pl 256 1728 0 228 94 0 94 94 0 8 0 ffsino 296 1728 0 228 116 0 116 116 0 8 0 nchpl 144 2018 0 270 65 0 65 65 0 8 0 vnodes 216 1977 0 0 110 0 110 110 0 8 0 namei 1024 8211 0 8211 3 1 2 2 0 8 2 percpumem 16 65 0 18 1 0 1 1 0 8 0 kstatmem 264 55 0 36 2 0 2 2 0 8 0 scxspl 216 6988 0 6988 3 2 1 2 1 8 1 plimitpl 152 51 0 34 1 0 1 1 0 8 0 sigapl 424 660 0 610 7 0 7 7 0 8 1 knotepl 120 57 0 0 2 0 2 2 0 8 0 kqueuepl 224 36 0 27 1 0 1 1 0 8 0 pipepl 344 177 0 150 3 0 3 3 0 8 0 fdescpl 528 644 0 611 3 0 3 3 0 8 0 filepl 160 2859 0 2651 15 0 15 15 0 8 5 lockfpl 104 46 0 44 1 0 1 1 0 8 0 lockfspl 48 21 0 19 1 0 1 1 0 8 0 sessionpl 144 48 0 39 1 0 1 1 0 8 0 pgrppl 48 80 0 63 1 0 1 1 0 8 0 ucredpl 104 194 0 181 1 0 1 1 0 8 0 zombiepl 144 611 0 610 1 0 1 1 0 8 0 processpl 1240 660 0 610 5 0 5 5 0 8 0 procpl 664 819 0 765 6 0 6 6 0 8 1 sockpl 752 829 0 799 27 15 12 17 0 8 8 mcl64k 65536 6 0 0 1 0 1 1 0 8 0 mcl16k 16384 3 0 0 1 0 1 1 0 8 0 mcl12k 12288 1 0 0 1 0 1 1 0 8 0 mcl8k 8192 4 0 0 1 0 1 1 0 8 0 mcl4k 4096 119 0 0 15 0 15 15 0 8 0 mcl2k 2048 25 0 0 4 0 4 4 0 8 0 mextrefs 64 23 0 0 1 0 1 1 0 8 0 mtagpl 96 1 0 0 1 0 1 1 0 8 0 mbufpl 256 3483 0 0 218 0 218 218 0 8 0 bufpl 272 2572 0 88 166 0 166 166 0 8 0 anonpl 32 3760 0 0 31 0 31 31 0 247 0 amapchunkpl 152 13047 0 12683 30 0 30 30 0 158 14 amappl16 200 1872 0 1859 5 3 2 5 0 8 0 amappl15 192 8 0 8 2 2 0 1 0 8 0 amappl14 184 543 0 538 1 0 1 1 0 8 0 amappl13 176 236 0 224 1 0 1 1 0 8 0 amappl12 168 932 0 903 2 0 2 2 0 8 0 amappl11 160 5 0 5 1 1 0 1 0 8 0 amappl10 152 69 0 57 1 0 1 1 0 8 0 amappl9 144 287 0 287 1 1 0 1 0 8 0 amappl8 136 138 0 133 1 0 1 1 0 8 0 amappl7 128 174 0 162 1 0 1 1 0 8 0 amappl6 120 179 0 174 1 0 1 1 0 8 0 amappl5 112 183 0 169 1 0 1 1 0 8 0 amappl4 104 309 0 292 1 0 1 1 0 8 0 amappl3 96 2501 0 2402 3 0 3 3 0 8 0 amappl2 88 484 0 429 2 0 2 2 0 8 0 amappl1 80 12030 0 11420 15 0 15 15 0 8 1 amappl 88 3732 0 3602 4 0 4 4 0 92 0 uvmvnodes 80 101 0 0 3 0 3 3 0 8 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 6 0 1 1 0 1 1 0 8 0 uaddrrnd 24 644 0 611 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 644 0 611 1 0 1 1 0 8 0 vmmpekpl 168 6988 0 6940 3 0 3 3 0 8 0 vmmpepl 168 50623 0 48870 86 0 86 86 0 357 3 vmsppl 488 643 0 611 6 1 5 5 0 8 0 rwobjpl 80 17570 0 16542 24 0 24 24 0 8 1 pdppl 4096 1295 0 1222 111 30 81 87 0 8 8 pvpl 32 9823 0 0 81 1 80 80 0 265 0 pmappl 256 643 0 611 4 1 3 3 0 8 0 extentpl 40 46 0 28 1 0 1 1 0 8 0 phpool 112 663 0 35 18 0 18 18 0 8 0 ddb{0}> machine ddbcpu 0 Invalid cpu 0 ddb{0}> trace db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:438 panic(ffffffff834eb340) at panic+0x1e5 sys/kern/subr_prf.c:198 __assert(ffffffff835286b3,ffffffff8356f46f,13f,ffffffff834632c1) at __assert+0x29 sys/kern/subr_prf.c:-1 tun_clone_destroy(ffff80000160d000) at tun_clone_destroy+0x38a if_clone_destroy(ffff80002a32f0c0) at if_clone_destroy+0x205 sys/net/if.c:1464 ifioctl(ffff800010fc6948,80206979,ffff80002a32f0c0,ffff80002a247ca0) at ifioctl+0x59d sys/net/if.c:2145 sys_ioctl(ffff80002a247ca0,ffff80002a32f2a0,ffff80002a32f1f0) at sys_ioctl+0x674 sys/kern/sys_generic.c:-1 syscall(ffff80002a32f2a0) at syscall+0xbd4 mi_syscall sys/sys/syscall_mi.h:176 [inline] syscall(ffff80002a32f2a0) at syscall+0xbd4 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x718b21f8e330, count: -9 ddb{0}> machine ddbcpu 1 Stopped at x86_ipi_db+0x27: addq $0x8,%rsp x86_ipi_db(ffff80002999dff0) at x86_ipi_db+0x27 sys/arch/amd64/amd64/db_interface.c:394 x86_ipi_handler() at x86_ipi_handler+0xd9 sys/arch/amd64/amd64/ipi.c:106 Xresume_lapic_ipi() at Xresume_lapic_ipi+0x27 __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x44 sys/dev/kcov.c:159 syscall(ffff80002a2b3dd0) at syscall+0xaf4 mi_syscall sys/sys/syscall_mi.h:175 [inline] syscall(ffff80002a2b3dd0) at syscall+0xaf4 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7d40770f48f0, count: 9 ddb{1}> trace x86_ipi_db(ffff80002999dff0) at x86_ipi_db+0x27 sys/arch/amd64/amd64/db_interface.c:394 x86_ipi_handler() at x86_ipi_handler+0xd9 sys/arch/amd64/amd64/ipi.c:106 Xresume_lapic_ipi() at Xresume_lapic_ipi+0x27 __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x44 sys/dev/kcov.c:159 syscall(ffff80002a2b3dd0) at syscall+0xaf4 mi_syscall sys/sys/syscall_mi.h:175 [inline] syscall(ffff80002a2b3dd0) at syscall+0xaf4 sys/arch/amd64/amd64/trap.c:791 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7d40770f48f0, count: -6