panic: kernel diagnostic assertion "sc->sc_dev == 0" failed: file "/syzkaller/managers/main/kernel/sys/net/if_tun.c", line 303 Stopped at db_enter+0x18: addq $0x8,%rsp TID PID UID PRFLAGS PFLAGS CPU COMMAND * 40978 46383 0 0x2 0 0 ifconfig db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff8258223a) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff825f5842,ffffffff8262390c,12f,ffffffff826054f8) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000bd6000) at tun_clone_destroy+0x234 sys/net/if_tun.c:303 if_clone_destroy(ffff80002e6ffb70) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff8000263f8000,ffff80002e6ffc80,ffff80002e6ffcd0) at sys_ioctl+0x49e syscall(ffff80002e6ffd50) at syscall+0x446 sys/arch/amd64/amd64/trap.c:599 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffcff80, 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 303 ddb> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff8258223a) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff825f5842,ffffffff8262390c,12f,ffffffff826054f8) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000bd6000) at tun_clone_destroy+0x234 sys/net/if_tun.c:303 if_clone_destroy(ffff80002e6ffb70) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff8000263f8000,ffff80002e6ffc80,ffff80002e6ffcd0) at sys_ioctl+0x49e syscall(ffff80002e6ffd50) at syscall+0x446 sys/arch/amd64/amd64/trap.c:599 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffcff80, count: -8 ddb> show registers rdi 0 rsi 0x1 rbp 0xffff80002e6ffa00 rbx 0x80206979 __kernel_virt_to_phys+0x206979 rdx 0 rcx 0 rax 0xffff8000263f8000 r8 0x101010101010101 r9 0x8080808080808080 r10 0xe86fb42793cfc03 r11 0xe2f206f7eda3125e r12 0 r13 0 r14 0 r15 0x1 rip 0xffffffff81d4ef58 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff80002e6ff9f0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb> show proc PROC (ifconfig) pid=40978 stat=onproc flags process=2 proc=0 pri=58, usrpri=58, nice=20 forw=0xffffffffffffffff, list=0xffff8000263f8a80,0xffffffff82a96958 process=0xffff80002179d7b0 user=0xffff80002e6fa000, vmspace=0xfffffd8078097de0 estcpu=8, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb> ps PID TID PPID UID S FLAGS WAIT COMMAND *46383 40978 56110 0 7 0x2 ifconfig 56110 288682 40649 0 3 0x10008a sigsusp sh 40649 352458 33668 0 3 0x82 wait syz-executor.0 65093 432689 33668 0 3 0x82 piperd syz-executor.6 34929 316515 33668 0 3 0x82 piperd syz-executor.3 34126 439619 33668 0 3 0x82 piperd syz-executor.1 1849 53785 33668 0 3 0x82 piperd syz-executor.7 58072 71833 1 0 3 0x100083 ttyin getty 56012 454860 33668 0 3 0x82 piperd syz-executor.5 74232 108628 33668 0 3 0x82 piperd syz-executor.4 93328 124313 33668 0 3 0x82 piperd syz-executor.2 54639 227648 0 0 3 0x14280 nfsidl nfsio 96352 194775 0 0 3 0x14280 nfsidl nfsio 72092 346718 0 0 3 0x14280 nfsidl nfsio 23952 225455 0 0 3 0x14280 nfsidl nfsio 40165 271734 0 0 3 0x14280 nfsidl nfsio 29109 350690 0 0 3 0x14280 nfsidl nfsio 51420 473576 0 0 3 0x14280 nfsidl nfsio 71282 453931 0 0 3 0x14280 nfsidl nfsio 52225 436692 0 0 3 0x14280 nfsidl nfsio 87410 142192 0 0 3 0x14280 nfsidl nfsio 20397 492143 0 0 3 0x14280 nfsidl nfsio 40028 495612 0 0 3 0x14280 nfsidl nfsio 48059 323961 0 0 3 0x14280 nfsidl nfsio 4344 205689 0 0 3 0x14280 nfsidl nfsio 88431 372875 0 0 3 0x14280 nfsidl nfsio 86926 194566 0 0 3 0x14280 nfsidl nfsio 4879 516819 0 0 3 0x14280 nfsidl nfsio 2806 394428 0 0 3 0x14280 nfsidl nfsio 31579 231450 0 0 3 0x14280 nfsidl nfsio 30594 441900 0 0 3 0x14280 nfsidl nfsio 61584 71006 0 0 3 0x14200 bored sosplice 33668 194567 57748 0 3 0x82 thrsleep syz-fuzzer 33668 445170 57748 0 2 0x4000482 syz-fuzzer 33668 89051 57748 0 3 0x4000082 wait syz-fuzzer 33668 283697 57748 0 3 0x4000082 thrsleep syz-fuzzer 33668 487194 57748 0 3 0x4000082 wait syz-fuzzer 33668 135486 57748 0 3 0x4000082 wait syz-fuzzer 33668 48706 57748 0 3 0x4000082 wait syz-fuzzer 33668 71651 57748 0 3 0x4000082 thrsleep syz-fuzzer 33668 222458 57748 0 3 0x4000082 wait syz-fuzzer 33668 499295 57748 0 3 0x4000082 thrsleep syz-fuzzer 33668 366188 57748 0 3 0x4000082 wait syz-fuzzer 33668 163859 57748 0 3 0x4000082 wait syz-fuzzer 33668 315045 57748 0 3 0x4000082 thrsleep syz-fuzzer 33668 130528 57748 0 3 0x4000082 wait syz-fuzzer 57748 457617 21588 0 3 0x10008a sigsusp ksh 21588 129687 94452 0 3 0x9a kqread sshd 94452 154126 1 0 3 0x88 kqread sshd 64541 379331 34460 73 3 0x1100090 kqread syslogd 34460 260349 1 0 3 0x100082 netio syslogd 10866 387317 1 0 3 0x100080 kqread resolvd 5541 329058 32104 77 2 0x100092 dhcpleased 40513 202951 32104 77 3 0x100092 kqread dhcpleased 32104 497350 1 0 3 0x80 kqread dhcpleased 31462 290068 0 0 3 0x14200 bored smr 56548 17926 0 0 2 0x14200 zerothread 50218 369254 0 0 3 0x14200 aiodoned aiodoned 43702 134308 0 0 3 0x14200 syncer update 88632 214956 0 0 3 0x14200 cleaner cleaner 20444 204709 0 0 3 0x14200 reaper reaper 31821 306100 0 0 3 0x14200 pgdaemon pagedaemon 42152 281327 0 0 3 0x14200 bored viomb 58066 46144 0 0 3 0x40014200 acpi0 acpi0 37851 159018 0 0 3 0x14200 bored softnet 30313 374044 0 0 3 0x14200 bored softnet 79931 160882 0 0 3 0x14200 bored softnet 20146 43962 0 0 3 0x14200 bored softnet 58376 57497 0 0 3 0x14200 bored systqmp 2937 40382 0 0 3 0x14200 bored systq 2021 57514 0 0 2 0x40014200 softclock 47118 109619 0 0 3 0x40014200 idle0 1 318449 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 10216 6433K 7205K 78643K 25609 0 pcb 13 22K 27K 78643K 2391 0 rtable 168 8K 9K 78643K 2700 0 ifaddr 93 23K 24K 78643K 1079 0 sysctl 2 0K 0K 78643K 4 0 counters 28 17K 17K 78643K 419 0 ioctlops 0 0K 4K 78643K 1269 0 iov 0 0K 36K 78643K 1770 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 4 0 vnodes 1559 97K 98K 78643K 13237 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 9K 78643K 111 0 VM map 2 0K 0K 78643K 2 0 sem 16 5K 10K 78643K 603 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 12 41K 73K 78643K 10146 0 sigio 0 0K 0K 78643K 239 0 proc 70 67K 75K 78643K 2293 0 subproc 104 6K 6K 78643K 728 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 471 0 in_multi 59 4K 6K 78643K 864 0 ether_multi 1 0K 0K 78643K 70 0 mrt 1 0K 0K 78643K 56 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 1893 0 pfkey data 0 0K 0K 78643K 3 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 414 718K 724K 78643K 68557 0 UVM aobj 131 4K 4K 78643K 131 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 315 0 NDP 12 0K 1K 78643K 346 0 temp 128 4690K 12878K 78643K 165980 0 kqueue 12 18K 28K 78643K 885 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 817 0 814 12 11 1 3 0 8 0 rtentry 112 785 0 716 5 2 3 4 0 8 0 unpcb 144 28186 0 28173 168 159 9 15 0 8 8 syncache 296 52 0 52 14 14 0 1 0 8 0 sackhl 24 2 2 2 2 2 0 1 0 8 0 tcpqe 32 83 0 83 11 11 0 1 0 8 0 tcpcb 776 4943 0 4939 119 118 1 11 0 8 0 arp 88 124 0 112 1 0 1 1 0 8 0 ipq 40 3 0 3 3 3 0 1 0 8 0 ipqe 40 12 0 12 3 3 0 1 0 8 0 inpcb 336 11397 0 11389 152 151 1 17 0 8 0 nd6 48 178 0 162 1 0 1 1 0 8 0 pkpcb 40 231 0 231 8 8 0 1 0 8 0 kcovpl 48 56 0 48 1 0 1 1 0 8 0 mppekey 1024 6 0 6 2 2 0 1 0 8 0 ppxss 1160 223 0 223 21 21 0 1 0 8 0 pppxif 1352 162 0 162 17 17 0 1 0 8 0 pfstscr 40 61 0 42 1 0 1 1 0 8 0 pfosfp 40 3 0 2 1 0 1 1 0 8 0 pfosfpen 112 3 0 2 1 0 1 1 0 8 0 pfanchor 1280 763 158 251 45 2 43 43 0 8 0 pfqueue 264 4 0 4 1 1 0 1 0 8 0 pfstitem 24 84 0 36 1 0 1 1 0 8 0 pfstkey 128 250 0 218 2 0 2 2 0 8 0 pfstate 352 125 0 101 3 0 3 3 0 8 0 rttmr 136 6 0 6 1 1 0 1 0 8 0 art_heap8 4096 2 0 1 2 1 1 2 0 8 0 art_heap4 256 3305 0 2996 61 39 22 29 0 8 0 art_table 32 3307 0 2997 5 1 4 4 0 8 0 art_node 16 779 0 719 1 0 1 1 0 8 0 sysvmsgpl 40 11 0 3 1 0 1 1 0 8 0 semupl 112 2 0 2 2 2 0 1 0 8 0 semapl 112 588 0 574 2 1 1 1 0 8 0 shmpl 112 128 0 0 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 16713 0 15228 94 0 94 94 0 8 0 ffsino 240 16713 0 15228 88 0 88 88 0 8 0 nchpl 144 30202 0 28582 63 0 63 63 0 8 0 rtmask 32 3 0 3 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 123734 0 123734 2 1 1 2 0 8 1 vcpupl 2048 106 0 0 14 0 14 14 0 8 0 vmpool 536 119 0 13 8 0 8 8 0 8 0 kstatmem 264 458 0 434 2 0 2 2 0 8 0 scsiplug 72 12 0 12 3 3 0 1 0 8 0 scxspl 216 81001 0 81001 30 29 1 8 0 8 1 plimitpl 152 1696 0 1681 1 0 1 1 0 8 0 sigapl 424 10366 0 10306 8 0 8 8 0 8 0 futexpl 64 110600 0 110600 1 0 1 1 0 8 1 knotepl 120 143218 0 143136 85 78 7 15 0 8 3 kqueuepl 184 2612 0 2604 37 36 1 4 0 8 0 pipepl 288 2183 0 2155 58 55 3 7 0 8 0 fdescpl 432 10326 0 10303 4 0 4 4 0 8 0 filepl 120 104057 0 103824 170 153 17 21 0 8 8 lockfpl 104 2784 0 2782 9 8 1 2 0 8 0 lockfspl 48 996 0 994 1 0 1 1 0 8 0 sessionpl 144 76 0 60 1 0 1 1 0 8 0 pgrppl 48 120 0 104 1 0 1 1 0 8 0 ucredpl 104 9150 0 9140 1 0 1 1 0 8 0 zombiepl 144 10306 0 10306 2 1 1 1 0 8 1 processpl 1008 10366 0 10306 10 1 9 9 0 8 0 procpl 672 27634 0 27561 20 11 9 9 0 8 0 sosppl 168 110 0 110 23 23 0 1 0 8 0 sockpl 456 40637 0 40613 1132 1121 11 50 0 8 8 mcl64k 65536 336 0 336 26 25 1 1 0 8 1 mcl16k 16384 245 0 245 32 31 1 1 0 8 1 mcl12k 12288 361 0 361 29 28 1 1 0 8 1 mcl9k 9216 115 0 115 29 28 1 1 0 8 1 mcl8k 8192 1132 0 1132 18 17 1 1 0 8 1 mcl4k 4096 1409 0 1409 6 5 1 1 0 8 1 mcl2k2 2112 92 0 92 36 35 1 1 0 8 1 mcl2k 2048 97243 0 97176 49 39 10 35 0 8 0 mtagpl 96 1082 0 735 16 3 13 13 0 8 0 mbufpl 256 354979 0 354432 551 495 56 90 0 8 8 bufpl 288 20860 0 14452 459 0 459 459 0 8 0 anonpl 24 1991290 0 1977136 167 52 115 129 0 188 1 amapchunkpl 152 189148 0 188563 73 43 30 36 0 158 2 amappl16 200 16274 0 15627 88 51 37 47 0 8 0 amappl15 192 11 0 10 2 1 1 1 0 8 0 amappl14 184 340 0 323 4 3 1 2 0 8 0 amappl13 176 7 0 6 1 0 1 1 0 8 0 amappl12 168 970 0 967 1 0 1 1 0 8 0 amappl11 160 53 0 43 1 0 1 1 0 8 0 amappl10 152 78 0 69 1 0 1 1 0 8 0 amappl9 144 998 0 996 1 0 1 1 0 8 0 amappl8 136 424 0 348 3 0 3 3 0 8 0 amappl7 128 261 0 236 2 0 2 2 0 8 0 amappl6 120 412 0 398 1 0 1 1 0 8 0 amappl5 112 436 0 427 1 0 1 1 0 8 0 amappl4 104 1166 0 1137 2 1 1 2 0 8 0 amappl3 96 29801 0 29765 2 0 2 2 0 8 0 amappl2 88 11469 0 11401 3 1 2 3 0 8 0 amappl1 80 236164 0 235547 30 13 17 22 0 8 0 amappl 88 67356 0 67166 7 1 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 130 0 0 3 0 3 3 0 8 0 uaddrrnd 24 10445 0 10316 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 10445 0 10316 1 0 1 1 0 8 0 vmmpekpl 168 80645 0 80569 4 0 4 4 0 8 0 vmmpepl 168 956706 0 954170 359 211 148 161 0 357 6 vmsppl 272 10444 0 10316 11 2 9 9 0 8 0 rwobjpl 24 251364 0 243577 51 3 48 49 0 8 0 pdppl 4096 20896 0 20738 741 575 166 170 0 8 8 pvpl 32 3870430 0 3851363 356 159 197 253 0 265 1 pmappl 216 10444 0 10316 8 0 8 8 0 8 0 extentpl 40 56 0 38 1 0 1 1 0 8 0 phpool 112 2372 0 1440 28 0 28 28 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(ffffffff8258223a) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff825f5842,ffffffff8262390c,12f,ffffffff826054f8) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000bd6000) at tun_clone_destroy+0x234 sys/net/if_tun.c:303 if_clone_destroy(ffff80002e6ffb70) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff8000263f8000,ffff80002e6ffc80,ffff80002e6ffcd0) at sys_ioctl+0x49e syscall(ffff80002e6ffd50) at syscall+0x446 sys/arch/amd64/amd64/trap.c:599 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffcff80, 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(ffffffff8258223a) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff825f5842,ffffffff8262390c,12f,ffffffff826054f8) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000bd6000) at tun_clone_destroy+0x234 sys/net/if_tun.c:303 if_clone_destroy(ffff80002e6ffb70) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff8000263f8000,ffff80002e6ffc80,ffff80002e6ffcd0) at sys_ioctl+0x49e syscall(ffff80002e6ffd50) at syscall+0x446 sys/arch/amd64/amd64/trap.c:599 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffcff80, count: -8