panic: kernel diagnostic assertion "sc->sc_dev == 0" failed: file "/syzkaller/managers/main/kernel/sys/net/if_tun.c", line 315 Stopped at db_enter+0x18: addq $0x8,%rsp TID PID UID PRFLAGS PFLAGS CPU COMMAND *212204 80723 0 0x2 0 0 ifconfig db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82722f34) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff827a0c78,ffffffff827d347f,13b,ffffffff827b3ae6) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000cf5800) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff80002ce1e500) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff800021676308,ffff80002ce1e610,ffff80002ce1e660) at sys_ioctl+0x49e syscall(ffff80002ce1e6e0) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7fffffbc80, 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 315 ddb> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff82722f34) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff827a0c78,ffffffff827d347f,13b,ffffffff827b3ae6) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000cf5800) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff80002ce1e500) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff800021676308,ffff80002ce1e610,ffff80002ce1e660) at sys_ioctl+0x49e syscall(ffff80002ce1e6e0) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7fffffbc80, count: -8 ddb> show registers rdi 0 rsi 0x1 rbp 0xffff80002ce1e390 rbx 0x80206979 __kernel_virt_to_phys+0x206979 rdx 0 rcx 0 rax 0xffff800021676308 r8 0 r9 0x8080808080808080 r10 0xbfab18d66f1641b7 r11 0xc572f64a81ebb772 r12 0 r13 0 r14 0 r15 0x1 rip 0xffffffff81a69eb8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff80002ce1e380 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb> show proc PROC (ifconfig) pid=212204 stat=onproc flags process=2 proc=0 pri=81, usrpri=81, nice=20 forw=0xffffffffffffffff, list=0xffff800021676b30,0xffffffff82cf3498 process=0xffff8000217173b0 user=0xffff80002ce19000, vmspace=0xfffffd8069b63418 estcpu=31, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb> ps PID TID PPID UID S FLAGS WAIT COMMAND *80723 212204 31402 0 7 0x2 ifconfig 31402 110050 1528 0 3 0x10008a sigsusp sh 72388 55478 26532 0 2 0 syz-executor.7 71434 173198 84390 0 2 0 syz-executor.3 71434 490928 84390 0 3 0x4000080 fsleep syz-executor.3 1528 364905 22758 0 3 0x82 wait syz-executor.0 65857 231212 74872 0 2 0 syz-executor.1 65857 317261 74872 0 3 0x4000080 fsleep syz-executor.1 28467 236637 0 0 3 0x14200 acct acct 47157 189441 22758 0 3 0x82 piperd syz-executor.5 50756 501146 22758 0 3 0x82 nanoslp syz-executor.6 39915 357028 22758 0 3 0x82 piperd syz-executor.4 19120 505859 1 0 3 0x100083 ttyin getty 26532 417679 22758 0 2 0x482 syz-executor.7 19614 348993 0 0 3 0x14280 nfsidl nfsio 95370 186517 0 0 3 0x14280 nfsidl nfsio 33150 417289 0 0 3 0x14280 nfsidl nfsio 69947 214431 0 0 3 0x14280 nfsidl nfsio 73071 395422 0 0 3 0x14280 nfsidl nfsio 60052 475571 0 0 3 0x14280 nfsidl nfsio 24658 147949 0 0 3 0x14280 nfsidl nfsio 46496 81272 0 0 3 0x14280 nfsidl nfsio 76325 351574 0 0 3 0x14280 nfsidl nfsio 27321 414985 0 0 3 0x14280 nfsidl nfsio 26973 331291 0 0 3 0x14280 nfsidl nfsio 11976 117254 0 0 3 0x14280 nfsidl nfsio 35930 318230 0 0 3 0x14280 nfsidl nfsio 76330 406721 0 0 3 0x14280 nfsidl nfsio 33902 8937 0 0 3 0x14280 nfsidl nfsio 84314 272455 0 0 3 0x14280 nfsidl nfsio 80582 486739 0 0 3 0x14280 nfsidl nfsio 63545 175436 0 0 3 0x14280 nfsidl nfsio 35009 456277 0 0 3 0x14280 nfsidl nfsio 37835 73624 0 0 3 0x14280 nfsidl nfsio 54433 422275 0 0 3 0x14200 bored sosplice 84390 410819 22758 0 2 0x482 syz-executor.3 42588 202632 22758 0 2 0x482 syz-executor.2 74872 453502 22758 0 3 0x82 nanoslp syz-executor.1 22758 306789 70597 0 3 0x82 wait syz-fuzzer 22758 481700 70597 0 3 0x4000082 nanoslp syz-fuzzer 22758 17253 70597 0 3 0x4000082 wait syz-fuzzer 22758 239658 70597 0 3 0x4000082 thrsleep syz-fuzzer 22758 326602 70597 0 3 0x4000082 wait syz-fuzzer 22758 271367 70597 0 3 0x4000082 thrsleep syz-fuzzer 22758 375939 70597 0 3 0x4000082 wait syz-fuzzer 22758 48295 70597 0 3 0x4000082 wait syz-fuzzer 22758 337309 70597 0 3 0x4000082 thrsleep syz-fuzzer 22758 21450 70597 0 3 0x4000082 thrsleep syz-fuzzer 22758 199591 70597 0 3 0x4000082 wait syz-fuzzer 22758 388137 70597 0 3 0x4000082 wait syz-fuzzer 22758 165803 70597 0 3 0x4000082 wait syz-fuzzer 22758 3475 70597 0 3 0x4000082 thrsleep syz-fuzzer 70597 36367 63140 0 3 0x10008a sigsusp ksh 63140 516097 43154 0 3 0x9a kqread sshd 43154 388079 1 0 3 0x88 kqread sshd 38573 266698 48130 73 3 0x1100090 kqread syslogd 48130 48134 1 0 3 0x100082 netio syslogd 32276 518909 1 0 3 0x100080 kqread resolvd 92460 219244 72933 77 2 0x100092 dhcpleased 93666 341170 72933 77 3 0x100092 kqread dhcpleased 72933 353835 1 0 3 0x80 kqread dhcpleased 71915 101278 0 0 3 0x14200 bored smr 71804 163342 0 0 2 0x14200 zerothread 9356 445799 0 0 3 0x14200 aiodoned aiodoned 4084 467645 0 0 3 0x14200 syncer update 12209 353044 0 0 3 0x14200 cleaner cleaner 84573 368012 0 0 3 0x14200 reaper reaper 78585 293784 0 0 3 0x14200 pgdaemon pagedaemon 22983 119007 0 0 3 0x14200 bored viomb 77378 68981 0 0 3 0x40014200 acpi0 acpi0 54588 99184 0 0 3 0x14200 bored softnet 61803 32060 0 0 3 0x14200 bored softnet 85118 304990 0 0 3 0x14200 bored softnet 41995 523439 0 0 3 0x14200 bored softnet 51811 388729 0 0 3 0x14200 bored systqmp 42781 415770 0 0 3 0x14200 bored systq 63932 67809 0 0 3 0x40014200 bored softclock 37916 292151 0 0 3 0x40014200 idle0 1 420814 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 10204 6425K 7058K 78643K 17947 0 pcb 13 16K 21K 78643K 1399 0 rtable 143 13K 16K 78643K 1700 0 ifaddr 75 21K 23K 78643K 435 0 sysctl 2 0K 0K 78643K 2 0 counters 28 17K 17K 78643K 276 0 ioctlops 0 0K 2K 78643K 452 0 iov 0 0K 32K 78643K 369 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 4 0 vnodes 1490 93K 94K 78643K 4220 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 5K 78643K 35 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 0K 78643K 1044 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 16 57K 73K 78643K 4226 0 sigio 0 0K 0K 78643K 132 0 proc 67 67K 75K 78643K 973 0 subproc 104 6K 6K 78643K 286 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 240 0 in_multi 60 4K 7K 78643K 823 0 ether_multi 1 0K 0K 78643K 29 0 mrt 1 0K 0K 78643K 16 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 67 307K 307K 78643K 67 0 exec 0 0K 1K 78643K 1015 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 290 85K 98K 78643K 27896 0 UVM aobj 131 4K 4K 78643K 133 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 68 0 NDP 13 0K 1K 78643K 189 0 temp 135 5770K 6798K 78643K 48494 0 kqueue 12 18K 26K 78643K 345 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 303 0 300 4 3 1 3 0 8 0 rtentry 112 640 0 582 4 1 3 4 0 8 0 unpcb 144 4444 0 4430 49 45 4 6 0 8 3 syncache 296 23 0 23 7 6 1 1 0 8 1 tcpqe 32 109 0 109 3 3 0 1 0 8 0 tcpcb 776 1566 0 1562 51 49 2 8 0 8 1 arp 88 46 0 38 1 0 1 1 0 8 0 ipq 40 4 0 4 2 2 0 1 0 8 0 ipqe 40 7 0 7 2 2 0 1 0 8 0 inpcb 336 5806 0 5798 94 89 5 13 0 8 4 nd6 48 145 0 133 1 0 1 1 0 8 0 pkpcb 40 2 0 2 1 1 0 1 0 8 0 kcovpl 48 22 0 14 1 0 1 1 0 8 0 mppekey 1024 67 0 67 1 1 0 1 0 8 0 ppxss 1160 208 0 208 4 4 0 1 0 8 0 pppxif 1360 122 0 122 4 4 0 1 0 8 0 pfstscr 40 10 0 4 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 16 0 0 2 0 2 2 0 8 0 pfqueue 264 5 0 5 1 1 0 1 0 8 0 pfstitem 24 12 0 0 1 0 1 1 0 8 0 pfstkey 128 20 0 16 1 0 1 1 0 8 0 pfstate 352 10 0 4 1 0 1 1 0 8 0 rttmr 136 3 0 3 1 1 0 1 0 8 0 art_heap8 4096 7 0 5 5 3 2 3 0 8 0 art_heap4 256 3385 0 3070 36 10 26 29 0 8 3 art_table 32 3392 0 3075 4 0 4 4 0 8 0 art_node 16 627 0 577 1 0 1 1 0 8 0 sysvmsgpl 40 15 0 9 2 1 1 1 0 8 0 semapl 112 1042 0 1032 1 0 1 1 0 8 0 shmpl 112 130 0 2 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 6777 0 5340 91 0 91 91 0 8 0 ffsino 240 6777 0 5340 85 0 85 85 0 8 0 nchpl 144 12602 0 10965 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 51854 0 51854 4 3 1 2 0 8 1 vmpool 664 16 0 16 4 4 0 1 0 8 0 kstatmem 264 130 0 104 2 0 2 2 0 8 0 scsiplug 72 4 0 4 1 1 0 1 0 8 0 scxspl 216 39104 0 39104 14 13 1 8 0 8 1 plimitpl 152 646 0 630 1 0 1 1 0 8 0 sigapl 424 4520 0 4454 8 0 8 8 0 8 0 futexpl 64 44160 0 44158 3 2 1 1 0 8 0 knotepl 120 54897 0 54814 44 32 12 15 0 8 8 kqueuepl 184 885 0 877 15 14 1 4 0 8 0 pipepl 288 1316 0 1288 19 16 3 7 0 8 0 fdescpl 432 4479 0 4452 4 0 4 4 0 8 0 filepl 120 39295 0 39057 63 51 12 16 0 8 3 lockfpl 104 845 0 842 2 1 1 2 0 8 0 lockfspl 48 277 0 274 1 0 1 1 0 8 0 sessionpl 144 39 0 23 1 0 1 1 0 8 0 pgrppl 48 65 0 49 1 0 1 1 0 8 0 ucredpl 104 10751 0 10741 1 0 1 1 0 8 0 zombiepl 144 4456 0 4454 1 0 1 1 0 8 0 processpl 1008 4520 0 4454 10 1 9 9 0 8 0 procpl 696 10444 0 10363 16 7 9 10 0 8 1 sosppl 168 23 0 23 6 6 0 1 0 8 0 sockpl 456 10558 0 10533 255 244 11 30 0 8 7 mcl64k 65536 157 0 157 10 9 1 1 0 8 1 mcl16k 16384 84 0 84 10 9 1 1 0 8 1 mcl12k 12288 126 0 126 10 9 1 1 0 8 1 mcl9k 9216 63 0 63 11 11 0 1 0 8 0 mcl8k 8192 199 0 199 8 7 1 1 0 8 1 mcl4k 4096 471 0 471 4 3 1 1 0 8 1 mcl2k2 2112 28 0 28 11 10 1 1 0 8 1 mcl2k 2048 82930 0 82850 42 30 12 31 0 8 0 mtagpl 96 783 0 491 13 3 10 11 0 8 1 mbufpl 256 172096 0 171078 326 260 66 132 0 8 0 bufpl 288 10259 0 3865 457 0 457 457 0 8 0 anonpl 24 861340 0 847307 158 45 113 130 0 188 0 amapchunkpl 152 84449 0 83784 60 29 31 42 0 158 2 amappl16 200 8441 0 7900 65 36 29 41 0 8 0 amappl15 192 8 0 7 1 0 1 1 0 8 0 amappl14 184 212 0 199 2 0 2 2 0 8 0 amappl13 176 10 0 8 1 0 1 1 0 8 0 amappl12 168 554 0 551 1 0 1 1 0 8 0 amappl11 160 43 0 33 1 0 1 1 0 8 0 amappl10 152 71 0 61 1 0 1 1 0 8 0 amappl9 144 992 0 992 3 2 1 1 0 8 1 amappl8 136 228 0 171 2 0 2 2 0 8 0 amappl7 128 171 0 148 2 0 2 2 0 8 0 amappl6 120 250 0 237 2 1 1 2 0 8 0 amappl5 112 222 0 215 1 0 1 1 0 8 0 amappl4 104 628 0 600 2 1 1 2 0 8 0 amappl3 96 12130 0 12084 2 0 2 2 0 8 0 amappl2 88 5016 0 4945 3 1 2 3 0 8 0 amappl1 80 101386 0 100691 33 16 17 26 0 8 1 amappl 88 27163 0 26995 5 0 5 5 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 132 0 2 3 0 3 3 0 8 0 uaddrrnd 24 4495 0 4468 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 4495 0 4468 1 0 1 1 0 8 0 vmmpekpl 168 36965 0 36914 3 0 3 3 0 8 0 vmmpepl 168 411081 0 408531 243 105 138 149 0 357 17 vmsppl 344 4494 0 4468 3 0 3 3 0 8 0 rwobjpl 24 110487 0 102805 49 2 47 48 0 8 0 pdppl 4096 8996 0 8936 277 213 64 68 0 8 4 pvpl 32 1755802 0 1735763 365 173 192 361 0 265 0 pmappl 216 4494 0 4468 2 0 2 2 0 8 0 extentpl 40 56 0 38 1 0 1 1 0 8 0 phpool 112 1479 0 659 26 0 26 26 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(ffffffff82722f34) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff827a0c78,ffffffff827d347f,13b,ffffffff827b3ae6) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000cf5800) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff80002ce1e500) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff800021676308,ffff80002ce1e610,ffff80002ce1e660) at sys_ioctl+0x49e syscall(ffff80002ce1e6e0) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7fffffbc80, 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(ffffffff82722f34) at panic+0x161 sys/kern/subr_prf.c:198 __assert(ffffffff827a0c78,ffffffff827d347f,13b,ffffffff827b3ae6) at __assert+0x25 sys/kern/subr_prf.c:157 tun_clone_destroy(ffff800000cf5800) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff80002ce1e500) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff800021676308,ffff80002ce1e610,ffff80002ce1e660) at sys_ioctl+0x49e syscall(ffff80002ce1e6e0) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7fffffbc80, count: -8