panic: kernel diagnostic assertion "sc->sc_dev == 0" failed: file "/syzkaller/managers/setuid/kernel/sys/net/if_tun.c", line 315 Stopped at db_enter+0x25: addq $0x8,%rsp TID PID UID PRFLAGS PFLAGS CPU COMMAND *494742 89220 0 0x8000002 0 1K ifconfig 199221 96791 77 0x18100012 0 0 dhcpleased db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff830dd675) at panic+0x1e5 sys/kern/subr_prf.c:198 __assert(ffffffff83090699,ffffffff830da216,13b,ffffffff830716e8) at __assert+0x29 tun_clone_destroy(ffff8000012c8800) at tun_clone_destroy+0x38a sys/net/if_tun.c:315 if_clone_destroy(ffff80002a1326b0) at if_clone_destroy+0x1d7 sys/net/if.c:1384 ifioctl(ffff80000117a2a8,80206979,ffff80002a1326b0,ffff80002fd97478) at ifioctl+0x5c5 sys_ioctl(ffff80002fd97478,ffff80002a132890,ffff80002a1327e0) at sys_ioctl+0x67c syscall(ffff80002a132890) at syscall+0xbb6 mi_syscall sys/sys/syscall_mi.h:179 [inline] syscall(ffff80002a132890) at syscall+0xbb6 sys/arch/amd64/amd64/trap.c:577 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x71b527c7c6f0, 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{1}> ddb{1}> set $lines = 0 ddb{1}> set $maxwidth = 0 ddb{1}> show panic *cpu1: kernel diagnostic assertion "sc->sc_dev == 0" failed: file "/syzkaller/managers/setuid/kernel/sys/net/if_tun.c", line 315 ddb{1}> trace db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff830dd675) at panic+0x1e5 sys/kern/subr_prf.c:198 __assert(ffffffff83090699,ffffffff830da216,13b,ffffffff830716e8) at __assert+0x29 tun_clone_destroy(ffff8000012c8800) at tun_clone_destroy+0x38a sys/net/if_tun.c:315 if_clone_destroy(ffff80002a1326b0) at if_clone_destroy+0x1d7 sys/net/if.c:1384 ifioctl(ffff80000117a2a8,80206979,ffff80002a1326b0,ffff80002fd97478) at ifioctl+0x5c5 sys_ioctl(ffff80002fd97478,ffff80002a132890,ffff80002a1327e0) at sys_ioctl+0x67c syscall(ffff80002a132890) at syscall+0xbb6 mi_syscall sys/sys/syscall_mi.h:179 [inline] syscall(ffff80002a132890) at syscall+0xbb6 sys/arch/amd64/amd64/trap.c:577 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x71b527c7c6f0, count: -9 ddb{1}> show registers rdi 0 rsi 0x1 rbp 0xffff80002a132460 rbx 0xffff800029b7cd87 rdx 0 rcx 0xffff80002fd97478 rax 0xffff800029b7bff0 r8 0x101010101010101 r9 0x8080808080808080 r10 0xb9ba7eff341992a r11 0xfcd0edad3f31ad69 r12 0xffff800029b7cb88 r13 0 r14 0 r15 0x1 rip 0xffffffff82103e25 db_enter+0x25 cs 0x8 rflags 0x246 rsp 0xffff80002a132450 ss 0x10 db_enter+0x25: addq $0x8,%rsp ddb{1}> show proc PROC (ifconfig) tid=494742 pid=89220 tcnt=1 stat=onproc flags process=8000002 proc=0 runpri=50, usrpri=50, slppri=17, nice=20 wchan=0x0, wmesg=, ps_single=0x0 scnt=0 ecnt=0 forw=0xffffffffffffffff, list=0xffff80002fd97c10,0xffffffff8356a1e0 process=0xffff80002db73618 user=0xffff80002a12d000, vmspace=0xfffffd806c2fb388 estcpu=3, cpticks=1, pctcpu=0.0, user=0, sys=1, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND *89220 494742 99440 0 7 0x8000002 ifconfig 90734 53499 87016 0 2 0x8000002 ifconfig 99440 104811 51328 0 3 0x810008a sigsusp sh 87016 240140 49857 0 3 0x810008a sigsusp sh 51328 252613 82423 0 3 0x8000080 wait syz-executor 49857 505654 21531 0 3 0x8000080 wait syz-executor 21531 313327 45763 0 3 0x8000082 wait syz-executor 82423 134201 45763 0 3 0x8000082 wait syz-executor 93986 408343 40801 32767 3 0x8000090 piperd syz-executor 40801 285373 45763 0 3 0x8000082 wait syz-executor 89426 134278 94430 32767 3 0x8000090 piperd syz-executor 45104 160118 2364 32767 3 0x8000090 piperd syz-executor 94430 294879 45763 0 3 0x8000082 wait syz-executor 2364 46310 45763 0 3 0x8000082 wait syz-executor 72858 418266 33433 32767 3 0x8000090 piperd syz-executor 33433 313353 45763 0 3 0x8000082 wait syz-executor 50251 88304 0 0 3 0x14200 bored sosplice 45763 417329 78048 0 3 0x8000082 nanoslp syz-executor 78048 53876 935 0 3 0x810008a sigsusp ksh 935 250921 5555 0 3 0x18000098 kqread sshd-session 5555 435769 39866 0 3 0x18000092 kqread sshd-session 11574 228892 1 0 3 0x18100083 ttyin getty 39866 75559 1 0 3 0x18000088 kqread sshd 66339 502496 37624 73 3 0x19100090 kqread syslogd 37624 512764 1 0 3 0x18100082 sbwait syslogd 83192 470540 1 0 3 0x18100080 kqread resolvd 96791 199221 57288 77 7 0x18100012 dhcpleased 32166 402819 57288 77 3 0x18100092 kqread dhcpleased 57288 218722 1 0 3 0x18000080 kqread dhcpleased 99678 250062 0 0 3 0x14200 bored smr 86454 144693 0 0 2 0x14200 zerothread 63101 519466 0 0 3 0x14200 aiodoned aiodoned 65210 74467 0 0 3 0x14200 syncer update 98299 424056 0 0 3 0x14200 cleaner cleaner 49749 269420 0 0 3 0x14200 reaper reaper 91410 81870 0 0 3 0x14200 pgdaemon pagedaemon 62052 148667 0 0 3 0x14200 bored viomb 30022 120224 0 0 3 0x40014200 acpi0 acpi0 25441 382193 0 0 3 0x40014200 idle1 11654 289911 0 0 3 0x14200 bored softnet3 7288 46174 0 0 3 0x14200 bored softnet2 39471 468723 0 0 3 0x14200 bored softnet1 14235 195073 0 0 3 0x14200 bored softnet0 96191 367538 0 0 3 0x14200 bored systqmp 91014 124246 0 0 3 0x14200 bored systq 48437 90460 0 0 3 0x14200 tmoslp softclockmp 68794 210550 0 0 3 0x40014200 tmoslp softclock 63639 224901 0 0 3 0x40014200 idle0 1 225040 0 0 3 0x8000082 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 89220 (ifconfig) thread 0xffff80002fd97478 (494742) exclusive rwlock clonelk r = 0 (0xffffffff8345e240) #0 witness_lock+0x5b8 stacktrace_save sys/sys/stacktrace.h:37 [inline] #0 witness_lock+0x5b8 sys/kern/subr_witness.c:1151 #1 if_clone_destroy+0x67 #2 ifioctl+0x5c5 #3 sys_ioctl+0x67c #4 syscall+0xbb6 mi_syscall sys/sys/syscall_mi.h:179 [inline] #4 syscall+0xbb6 sys/arch/amd64/amd64/trap.c:577 #5 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 0 (0xffffffff83625990) #0 witness_lock+0x5b8 stacktrace_save sys/sys/stacktrace.h:37 [inline] #0 witness_lock+0x5b8 sys/kern/subr_witness.c:1151 #1 ifioctl+0x5b4 sys/net/if.c:2061 #2 sys_ioctl+0x67c #3 syscall+0xbb6 mi_syscall sys/sys/syscall_mi.h:179 [inline] #3 syscall+0xbb6 sys/arch/amd64/amd64/trap.c:577 #4 Xsyscall+0x128 ddb{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 10206 10088K 10100K 166960K 11376 0 pcb 17 14K 16K 166960K 19 0 rtable 168 4K 6K 166960K 1153 0 pf 27 16K 16K 166960K 89 0 ifaddr 31 5K 7K 166960K 154 0 ifgroup 42 1K 2K 166960K 164 0 sysctl 4 1K 1K 166960K 4 0 counters 60 35K 36K 166960K 120 0 ioctlops 0 0K 2K 166960K 65 0 iov 0 0K 20K 166960K 59 0 mount 1 1K 1K 166960K 1 0 log 0 0K 0K 166960K 4 0 vnodes 1398 88K 88K 166960K 1740 0 UFS quota 1 32K 32K 166960K 1 0 UFS mount 5 36K 36K 166960K 5 0 shm 2 1K 5K 166960K 8 0 VM map 2 1K 1K 166960K 2 0 sem 11 1K 1K 166960K 18 0 dirhash 12 2K 3K 166960K 30 0 ACPI 1697 195K 286K 166960K 12548 0 file desc 18 65K 193K 166960K 926 0 sigio 0 0K 0K 166960K 7 0 proc 63 91K 213K 166960K 1279 0 subproc 42 2K 8K 166960K 336 0 NFS srvsock 1 0K 0K 166960K 1 0 NFS daemon 1 16K 16K 166960K 1 0 ip_moptions 0 0K 0K 166960K 521 0 in_multi 66 4K 7K 166960K 395 0 ether_multi 1 0K 0K 166960K 3 0 mrt 1 0K 0K 166960K 1 0 ISOFS mount 1 32K 32K 166960K 1 0 MSDOSFS mount 1 16K 16K 166960K 1 0 ttys 247 1102K 1102K 166960K 247 0 exec 0 0K 1K 166960K 746 0 tdb 3 0K 0K 166960K 3 0 VM swap 8 62K 64K 166960K 10 0 UVM amap 175 55K 164K 166960K 8144 0 UVM aobj 15 2K 4K 166960K 16 0 pinsyscall 39 78K 144K 166960K 2613 0 memdesc 1 4K 4K 166960K 1 0 crypto data 1 1K 1K 166960K 1 0 ip6_options 0 0K 0K 166960K 24 0 NDP 9 0K 2K 166960K 106 0 temp 84 6816K 6897K 166960K 8993 0 kqueue 13 20K 30K 166960K 91 0 SYN cache 2 16K 16K 166960K 2 0 ddb{1}> show all pools Name Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle plcache 128 24 0 0 1 0 1 1 0 8 0 rtpcb 120 131 0 128 1 0 1 1 0 8 0 rtentry 112 404 0 327 4 1 3 4 0 8 0 unpcb 144 623 0 608 10 9 1 9 0 8 0 syncache 336 5 0 5 2 2 0 1 0 8 0 tcpqe 32 2 0 2 1 1 0 1 0 8 0 tcpcb 808 308 0 304 14 13 1 8 0 8 0 arp 120 71 0 59 1 0 1 1 0 8 0 ipq 40 4 0 4 1 1 0 1 0 8 0 ipqe 40 4 0 4 1 1 0 1 0 8 0 inpcb 336 1368 0 1360 27 26 1 13 0 8 0 ip6q 72 1 0 1 1 1 0 1 0 8 0 ip6af 40 2 0 2 1 1 0 1 0 8 0 nd6 136 108 0 93 1 0 1 1 0 8 0 kcovpl 48 48 0 42 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 1637 0 1313 39 17 22 29 0 8 0 art_table 32 1638 0 1313 4 1 3 4 0 8 0 art_node 16 403 0 333 1 0 1 1 0 8 0 sysvmsgpl 40 1 0 1 1 1 0 1 0 8 0 semapl 112 12 0 3 1 0 1 1 0 8 0 shmpl 112 13 0 1 1 0 1 1 0 8 0 dirhash 1024 29 0 12 3 0 3 3 0 8 0 dino2pl 256 2261 0 693 101 2 99 99 0 8 0 ffsino 272 2261 0 693 105 0 105 105 0 8 0 nchpl 144 2950 0 1229 64 0 64 64 0 8 0 uvmvnodes 80 2606 0 0 54 0 54 54 0 8 0 vnodes 216 2606 0 0 145 0 145 145 0 8 0 namei 1024 13120 0 13120 7 6 1 2 0 8 1 percpumem 16 74 0 30 1 0 1 1 0 8 0 kstatmem 264 78 0 60 2 0 2 2 0 8 0 scxspl 216 20867 0 20867 17 16 1 8 1 8 1 plimitpl 152 343 0 322 2 1 1 2 0 8 0 sigapl 424 1117 0 1067 12 4 8 10 0 8 0 futexpl 64 6284 0 6284 4 3 1 1 0 8 1 knotepl 120 393 0 0 11 1 10 10 0 8 0 kqueuepl 216 148 0 139 2 0 2 2 0 8 1 pipepl 320 436 0 409 17 12 5 8 0 8 0 fdescpl 496 1098 0 1068 11 5 6 8 0 8 0 filepl 152 6921 0 6757 38 26 12 22 0 8 0 lockfpl 104 137 0 135 1 0 1 1 0 8 0 lockfspl 48 55 0 53 1 0 1 1 0 8 0 sessionpl 144 53 0 39 2 0 2 2 0 8 0 pgrppl 48 173 0 152 1 0 1 1 0 8 0 ucredpl 104 1410 0 1395 1 0 1 1 0 8 0 zombiepl 144 1068 0 1067 1 0 1 1 0 8 0 processpl 1152 1117 0 1067 6 0 6 6 0 8 0 procpl 648 1759 0 1709 8 2 6 8 0 8 0 srpgc 96 2 0 0 1 0 1 1 0 8 0 sosppl 168 1 0 1 1 1 0 1 0 8 0 sockpl 664 2197 0 2171 46 43 3 23 0 8 0 mcl64k 65536 4 0 0 1 0 1 1 0 8 0 mcl16k 16384 2 0 0 1 0 1 1 0 8 0 mcl8k 8192 5 0 0 1 0 1 1 0 8 0 mcl4k 4096 5 0 0 1 0 1 1 0 8 0 mcl2k2 2112 3 0 0 1 0 1 1 0 8 0 mcl2k 2048 216 0 0 27 0 27 27 0 8 0 mtagpl 96 4 0 0 1 0 1 1 0 8 0 mbufpl 256 977 0 0 62 2 60 62 0 8 0 bufpl 280 7574 0 808 484 0 484 484 0 8 0 anonpl 24 253238 0 250216 178 124 54 132 0 185 15 amapchunkpl 152 27370 0 27033 79 55 24 58 0 158 0 amappl16 200 5804 0 5802 49 48 1 27 0 8 0 amappl15 192 9 0 9 1 1 0 1 0 8 0 amappl14 184 182 0 172 1 0 1 1 0 8 0 amappl13 176 13 0 13 2 2 0 1 0 8 0 amappl12 168 2129 0 2101 3 0 3 3 0 8 0 amappl11 160 65 0 55 1 0 1 1 0 8 0 amappl10 152 10 0 10 1 1 0 1 0 8 0 amappl9 144 141 0 141 1 1 0 1 0 8 0 amappl8 136 19 0 17 1 0 1 1 0 8 0 amappl7 128 146 0 136 1 0 1 1 0 8 0 amappl6 120 434 0 429 1 0 1 1 0 8 0 amappl5 112 248 0 237 1 0 1 1 0 8 0 amappl4 104 354 0 337 1 0 1 1 0 8 0 amappl3 96 4895 0 4820 5 2 3 5 0 8 0 amappl2 88 962 0 900 2 0 2 2 0 8 0 amappl1 80 11252 0 10719 15 1 14 14 0 8 0 amappl 88 7573 0 7449 7 1 6 7 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 15 0 1 1 0 1 1 0 8 0 uaddrrnd 24 1098 0 1068 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 1098 0 1068 1 0 1 1 0 8 0 vmmpekpl 168 11364 0 11311 5 0 5 5 0 8 0 vmmpepl 168 79547 0 77904 156 54 102 141 0 357 0 vmsppl 440 1097 0 1068 8 2 6 7 0 8 0 rwobjpl 56 28245 0 24826 61 2 59 59 0 8 0 pdppl 4096 2203 0 2136 251 184 67 131 0 8 0 pvpl 32 69530 0 0 561 0 561 561 0 265 0 pmappl 248 1097 0 1068 5 1 4 4 0 8 0 extentpl 40 56 0 38 1 0 1 1 0 8 0 phpool 112 646 0 254 14 0 14 14 0 8 0 ddb{1}> machine ddbcpu 0 Stopped at x86_ipi_db+0x27: addq $0x8,%rsp x86_ipi_db(ffffffff83419ff0) at x86_ipi_db+0x27 sys/arch/amd64/amd64/db_interface.c:393 x86_ipi_handler() at x86_ipi_handler+0xd9 sys/arch/amd64/amd64/ipi.c:106 Xresume_lapic_ipi() at Xresume_lapic_ipi+0x27 __mp_lock(ffffffff83625788) at __mp_lock+0x192 __mp_lock_spin sys/kern/kern_lock.c:113 [inline] __mp_lock(ffffffff83625788) at __mp_lock+0x192 sys/kern/kern_lock.c:144 softintr_dispatch(0) at softintr_dispatch+0x5b sys/arch/amd64/amd64/softintr.c:88 Xsoftclock() at Xsoftclock+0x27 __mp_lock(ffffffff83625788) at __mp_lock+0x192 __mp_lock_spin sys/kern/kern_lock.c:113 [inline] __mp_lock(ffffffff83625788) at __mp_lock+0x192 sys/kern/kern_lock.c:144 sysctl_vslock(0,efdcde40a6345f6e) at sysctl_vslock+0x39 sys/kern/kern_sysctl.c:176 sys_sysctl(ffff8000ffffc520,ffff80002a048870,ffff80002a0487c0) at sys_sysctl+0x392 sys/kern/kern_sysctl.c:286 syscall(ffff80002a048870) at syscall+0xbb6 mi_syscall sys/sys/syscall_mi.h:179 [inline] syscall(ffff80002a048870) at syscall+0xbb6 sys/arch/amd64/amd64/trap.c:577 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7ba7c2f820e0, count: 4 ddb{0}> trace x86_ipi_db(ffffffff83419ff0) at x86_ipi_db+0x27 sys/arch/amd64/amd64/db_interface.c:393 x86_ipi_handler() at x86_ipi_handler+0xd9 sys/arch/amd64/amd64/ipi.c:106 Xresume_lapic_ipi() at Xresume_lapic_ipi+0x27 __mp_lock(ffffffff83625788) at __mp_lock+0x192 __mp_lock_spin sys/kern/kern_lock.c:113 [inline] __mp_lock(ffffffff83625788) at __mp_lock+0x192 sys/kern/kern_lock.c:144 softintr_dispatch(0) at softintr_dispatch+0x5b sys/arch/amd64/amd64/softintr.c:88 Xsoftclock() at Xsoftclock+0x27 __mp_lock(ffffffff83625788) at __mp_lock+0x192 __mp_lock_spin sys/kern/kern_lock.c:113 [inline] __mp_lock(ffffffff83625788) at __mp_lock+0x192 sys/kern/kern_lock.c:144 sysctl_vslock(0,efdcde40a6345f6e) at sysctl_vslock+0x39 sys/kern/kern_sysctl.c:176 sys_sysctl(ffff8000ffffc520,ffff80002a048870,ffff80002a0487c0) at sys_sysctl+0x392 sys/kern/kern_sysctl.c:286 syscall(ffff80002a048870) at syscall+0xbb6 mi_syscall sys/sys/syscall_mi.h:179 [inline] syscall(ffff80002a048870) at syscall+0xbb6 sys/arch/amd64/amd64/trap.c:577 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7ba7c2f820e0, count: -11 ddb{0}> machine ddbcpu 1 Stopped at db_enter+0x25: addq $0x8,%rsp db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff830dd675) at panic+0x1e5 sys/kern/subr_prf.c:198 __assert(ffffffff83090699,ffffffff830da216,13b,ffffffff830716e8) at __assert+0x29 tun_clone_destroy(ffff8000012c8800) at tun_clone_destroy+0x38a sys/net/if_tun.c:315 if_clone_destroy(ffff80002a1326b0) at if_clone_destroy+0x1d7 sys/net/if.c:1384 ifioctl(ffff80000117a2a8,80206979,ffff80002a1326b0,ffff80002fd97478) at ifioctl+0x5c5 sys_ioctl(ffff80002fd97478,ffff80002a132890,ffff80002a1327e0) at sys_ioctl+0x67c syscall(ffff80002a132890) at syscall+0xbb6 mi_syscall sys/sys/syscall_mi.h:179 [inline] syscall(ffff80002a132890) at syscall+0xbb6 sys/arch/amd64/amd64/trap.c:577 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x71b527c7c6f0, count: 6 ddb{1}> trace db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff830dd675) at panic+0x1e5 sys/kern/subr_prf.c:198 __assert(ffffffff83090699,ffffffff830da216,13b,ffffffff830716e8) at __assert+0x29 tun_clone_destroy(ffff8000012c8800) at tun_clone_destroy+0x38a sys/net/if_tun.c:315 if_clone_destroy(ffff80002a1326b0) at if_clone_destroy+0x1d7 sys/net/if.c:1384 ifioctl(ffff80000117a2a8,80206979,ffff80002a1326b0,ffff80002fd97478) at ifioctl+0x5c5 sys_ioctl(ffff80002fd97478,ffff80002a132890,ffff80002a1327e0) at sys_ioctl+0x67c syscall(ffff80002a132890) at syscall+0xbb6 mi_syscall sys/sys/syscall_mi.h:179 [inline] syscall(ffff80002a132890) at syscall+0xbb6 sys/arch/amd64/amd64/trap.c:577 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x71b527c7c6f0, count: -9