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 *469003 27978 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(ffff800000e51800) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff8000299b0130) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff8000216f4030,ffff8000299b0240,ffff8000299b0290) at sys_ioctl+0x49e syscall(ffff8000299b0310) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffdda10, 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(ffff800000e51800) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff8000299b0130) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff8000216f4030,ffff8000299b0240,ffff8000299b0290) at sys_ioctl+0x49e syscall(ffff8000299b0310) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffdda10, count: -8 ddb> show registers rdi 0 rsi 0x1 rbp 0xffff8000299affc0 rbx 0x80206979 __kernel_virt_to_phys+0x206979 rdx 0 rcx 0 rax 0xffff8000216f4030 r8 0x101010101010101 r9 0x8080808080808080 r10 0x167cbed67951f974 r11 0xc4f480123dd84582 r12 0 r13 0 r14 0 r15 0x1 rip 0xffffffff81a69eb8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff8000299affb0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb> show proc PROC (ifconfig) pid=469003 stat=onproc flags process=2 proc=0 pri=83, usrpri=83, nice=20 forw=0xffffffffffffffff, list=0xffff8000216f55f0,0xffffffff82cf3498 process=0xffff8000216f6fc0 user=0xffff8000299ab000, vmspace=0xfffffd8069b64010 estcpu=33, cpticks=2, pctcpu=0.0 user=0, sys=2, intr=0 ddb> ps PID TID PPID UID S FLAGS WAIT COMMAND *27978 469003 89480 0 7 0x2 ifconfig 89480 483161 32970 0 3 0x10008a sigsusp sh 32970 406649 74153 0 3 0x82 wait syz-executor.0 53687 405034 74153 0 3 0x82 piperd syz-executor.3 21737 204914 74153 0 3 0x82 piperd syz-executor.6 87901 353959 74153 0 3 0x82 piperd syz-executor.7 8673 188331 74153 0 3 0x82 piperd syz-executor.5 23404 158395 74153 0 3 0x82 piperd syz-executor.4 51659 220128 74153 0 3 0x82 piperd syz-executor.1 29465 480664 74153 0 3 0x82 piperd syz-executor.2 28802 472987 0 0 3 0x14280 nfsidl nfsio 43516 424904 0 0 3 0x14280 nfsidl nfsio 47174 341433 0 0 3 0x14280 nfsidl nfsio 25219 271934 0 0 3 0x14280 nfsidl nfsio 8133 159046 0 0 3 0x14280 nfsidl nfsio 2706 170668 0 0 3 0x14280 nfsidl nfsio 3582 104117 0 0 3 0x14280 nfsidl nfsio 34406 349311 0 0 3 0x14280 nfsidl nfsio 64565 365551 0 0 3 0x14280 nfsidl nfsio 79815 522849 0 0 3 0x14280 nfsidl nfsio 86695 145989 0 0 3 0x14280 nfsidl nfsio 38959 34288 0 0 3 0x14280 nfsidl nfsio 52075 244726 0 0 3 0x14280 nfsidl nfsio 71323 85619 0 0 3 0x14280 nfsidl nfsio 41234 213675 0 0 3 0x14280 nfsidl nfsio 33576 450822 0 0 3 0x14280 nfsidl nfsio 27223 168990 0 0 3 0x14280 nfsidl nfsio 24892 84219 0 0 3 0x14280 nfsidl nfsio 55474 66432 0 0 3 0x14280 nfsidl nfsio 43077 173331 0 0 3 0x14280 nfsidl nfsio 5847 438098 1 0 3 0x100083 ttyin getty 87507 252627 0 0 3 0x14200 bored sosplice 74153 341221 65650 0 3 0x82 wait syz-fuzzer 74153 150602 65650 0 3 0x4000082 nanoslp syz-fuzzer 74153 253671 65650 0 3 0x4000082 wait syz-fuzzer 74153 358315 65650 0 3 0x4000082 wait syz-fuzzer 74153 112245 65650 0 3 0x4000082 wait syz-fuzzer 74153 88862 65650 0 3 0x4000082 thrsleep syz-fuzzer 74153 348113 65650 0 3 0x4000082 thrsleep syz-fuzzer 74153 122896 65650 0 3 0x4000082 thrsleep syz-fuzzer 74153 36550 65650 0 3 0x4000082 wait syz-fuzzer 74153 170718 65650 0 3 0x4000082 thrsleep syz-fuzzer 74153 348331 65650 0 3 0x4000082 wait syz-fuzzer 74153 165241 65650 0 3 0x4000082 wait syz-fuzzer 74153 39164 65650 0 3 0x4000082 wait syz-fuzzer 74153 20303 65650 0 3 0x4000082 thrsleep syz-fuzzer 74153 317275 65650 0 3 0x4000082 thrsleep syz-fuzzer 65650 248881 62930 0 3 0x10008a sigsusp ksh 62930 326739 72401 0 3 0x9a kqread sshd 72401 252567 1 0 3 0x88 kqread sshd 43228 458045 99100 73 3 0x1100090 kqread syslogd 99100 503099 1 0 3 0x100082 netio syslogd 79484 33491 1 0 3 0x100080 kqread resolvd 23235 438424 85463 77 2 0x100092 dhcpleased 51926 275159 85463 77 3 0x100092 kqread dhcpleased 85463 436496 1 0 3 0x80 kqread dhcpleased 51372 158337 0 0 3 0x14200 bored smr 71550 403286 0 0 2 0x14200 zerothread 76042 323346 0 0 3 0x14200 aiodoned aiodoned 71175 306705 0 0 3 0x14200 syncer update 48986 452934 0 0 3 0x14200 cleaner cleaner 8113 221411 0 0 3 0x14200 reaper reaper 86870 129295 0 0 3 0x14200 pgdaemon pagedaemon 65270 393465 0 0 3 0x14200 bored viomb 57165 448228 0 0 3 0x40014200 acpi0 acpi0 89746 127772 0 0 3 0x14200 bored softnet 26397 457675 0 0 3 0x14200 bored softnet 87861 21716 0 0 3 0x14200 bored softnet 3285 190805 0 0 3 0x14200 bored softnet 48683 286978 0 0 3 0x14200 bored systqmp 20578 458859 0 0 3 0x14200 bored systq 54823 121815 0 0 2 0x40014200 softclock 66680 342584 0 0 3 0x40014200 idle0 1 155480 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 10219 6431K 6926K 78643K 22236 0 pcb 13 18K 21K 78643K 2438 0 rtable 195 15K 16K 78643K 2755 0 ifaddr 78 23K 25K 78643K 1095 0 sysctl 2 0K 0K 78643K 6 0 counters 27 17K 17K 78643K 414 0 ioctlops 0 0K 4K 78643K 1176 0 iov 0 0K 32K 78643K 2056 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 4 0 vnodes 1473 92K 92K 78643K 7852 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 9K 78643K 96 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 1K 78643K 866 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 12 41K 69K 78643K 8788 0 sigio 0 0K 0K 78643K 323 0 proc 70 67K 75K 78643K 2113 0 subproc 104 6K 7K 78643K 745 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 482 0 in_multi 80 5K 7K 78643K 887 0 ether_multi 1 0K 0K 78643K 54 0 mrt 1 0K 0K 78643K 50 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 235 1049K 1049K 78643K 235 0 exec 0 0K 1K 78643K 2299 0 pfkey data 0 0K 0K 78643K 5 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 305 96K 108K 78643K 57422 0 UVM aobj 131 8K 8K 78643K 140 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 563 0 NDP 11 0K 2K 78643K 353 0 temp 124 5770K 6798K 78643K 165229 0 kqueue 12 18K 26K 78643K 872 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 1278 0 1275 18 17 1 3 0 8 0 rtentry 112 845 0 762 4 1 3 4 0 8 0 unpcb 144 7775 0 7762 74 72 2 10 0 8 1 syncache 296 69 0 69 15 15 0 1 0 8 0 tcpqe 32 1468 55 1468 8 8 0 2 0 8 0 tcpcb 776 3234 0 3226 122 121 1 11 0 8 0 arp 88 128 0 114 1 0 1 1 0 8 0 ipq 40 9 0 9 5 5 0 1 0 8 0 ipqe 40 25 0 25 5 5 0 1 0 8 0 inpcb 336 9947 0 9935 157 150 7 15 0 8 4 nd6 48 185 0 165 1 0 1 1 0 8 0 pkpcb 40 55 0 55 7 7 0 1 0 8 0 kcovpl 48 57 0 49 1 0 1 1 0 8 0 mppekey 1024 13 0 13 4 4 0 1 0 8 0 ppxss 1160 227 0 227 18 17 1 1 0 8 1 pppxif 1360 134 0 134 17 16 1 1 0 8 1 pfstscr 40 138 0 125 1 0 1 1 0 8 0 pfanchor 1280 715 32 203 46 3 43 43 0 8 0 pfqueue 264 14 0 14 4 4 0 1 0 8 0 pfstitem 24 22 0 0 1 0 1 1 0 8 0 pfstkey 128 259 0 250 1 0 1 1 0 8 0 pfstate 352 131 0 120 4 3 1 2 0 8 0 rttmr 136 14 0 14 4 3 1 1 0 8 1 art_heap8 4096 2 0 1 2 1 1 2 0 8 0 art_heap4 256 3738 0 3375 56 32 24 31 0 8 0 art_table 32 3740 0 3376 4 0 4 4 0 8 0 art_node 16 821 0 749 1 0 1 1 0 8 0 sysvmsgpl 40 24 0 17 1 0 1 1 0 8 0 semupl 112 5 0 5 1 1 0 1 0 8 0 semapl 112 862 0 852 1 0 1 1 0 8 0 shmpl 112 137 0 9 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 13735 0 12266 93 0 93 93 0 8 0 ffsino 240 13735 0 12266 88 0 88 88 0 8 0 nchpl 144 27092 0 25461 63 1 62 63 0 8 0 rtmask 32 9 0 9 3 3 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 106012 0 106012 11 10 1 3 0 8 1 vmpool 664 21 0 21 5 5 0 1 0 8 0 kstatmem 264 462 0 440 2 0 2 2 0 8 0 scsiplug 72 6 0 6 1 1 0 1 0 8 0 scxspl 216 78145 0 78145 29 28 1 8 0 8 1 plimitpl 152 1253 0 1238 1 0 1 1 0 8 0 sigapl 424 9027 0 8967 10 2 8 8 0 8 0 futexpl 64 98054 0 98054 4 3 1 1 0 8 1 knotepl 120 175594 0 175512 64 60 4 11 0 8 0 kqueuepl 184 2382 0 2374 38 37 1 8 0 8 0 pipepl 288 2596 0 2568 46 43 3 8 0 8 0 fdescpl 432 8968 0 8945 4 0 4 4 0 8 0 filepl 120 78397 0 78164 112 102 10 19 0 8 2 lockfpl 104 2426 0 2424 6 5 1 2 0 8 0 lockfspl 48 628 0 626 1 0 1 1 0 8 0 sessionpl 144 74 0 58 1 0 1 1 0 8 0 pgrppl 48 203 0 187 1 0 1 1 0 8 0 ucredpl 104 9967 0 9956 1 0 1 1 0 8 0 zombiepl 144 8967 0 8967 6 5 1 1 0 8 1 processpl 1008 9027 0 8967 13 4 9 9 0 8 0 procpl 696 22074 0 22000 16 7 9 9 0 8 0 sosppl 168 68 0 68 13 13 0 1 0 8 0 sockpl 456 19132 0 19102 402 390 12 35 0 8 7 mcl64k 65536 321 0 321 21 20 1 1 0 8 1 mcl16k 16384 198 0 198 24 23 1 1 0 8 1 mcl12k 12288 277 0 277 20 19 1 1 0 8 1 mcl9k 9216 128 0 128 23 22 1 1 0 8 1 mcl8k 8192 1305 0 1305 17 16 1 1 0 8 1 mcl4k 4096 1148 0 1148 15 14 1 1 0 8 1 mcl2k2 2112 72 0 72 24 24 0 1 0 8 0 mcl2k 2048 91684 0 91584 108 93 15 41 0 8 0 mtagpl 96 839 0 724 11 6 5 5 0 8 0 mbufpl 256 282828 0 282499 523 490 33 91 0 8 4 bufpl 288 19509 0 13115 457 0 457 457 0 8 0 anonpl 24 1797476 0 1783252 287 170 117 180 0 188 0 amapchunkpl 152 164734 0 164132 121 91 30 58 0 158 0 amappl16 200 18541 0 17920 139 105 34 44 0 8 0 amappl15 192 5 0 5 1 1 0 1 0 8 0 amappl14 184 329 0 318 2 1 1 2 0 8 0 amappl13 176 10 0 10 1 1 0 1 0 8 0 amappl12 168 980 0 976 1 0 1 1 0 8 0 amappl11 160 49 0 38 1 0 1 1 0 8 0 amappl10 152 107 0 96 1 0 1 1 0 8 0 amappl9 144 998 0 997 1 0 1 1 0 8 0 amappl8 136 430 0 347 3 0 3 3 0 8 0 amappl7 128 250 0 226 2 0 2 2 0 8 0 amappl6 120 405 0 393 2 1 1 2 0 8 0 amappl5 112 487 0 478 1 0 1 1 0 8 0 amappl4 104 1091 0 1062 2 1 1 2 0 8 0 amappl3 96 25057 0 25019 2 0 2 2 0 8 0 amappl2 88 10092 0 10020 3 0 3 3 0 8 0 amappl1 80 201689 0 201073 30 14 16 26 0 8 0 amappl 88 56249 0 56091 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 139 0 9 3 0 3 3 0 8 0 uaddrrnd 24 8989 0 8966 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 8989 0 8966 1 0 1 1 0 8 0 vmmpekpl 168 70253 0 70205 3 0 3 3 0 8 0 vmmpepl 168 834704 0 832350 340 199 141 148 0 357 9 vmsppl 344 8988 0 8966 3 0 3 3 0 8 0 rwobjpl 24 217834 0 210113 57 8 49 49 0 8 0 pdppl 4096 17984 0 17932 663 599 64 66 0 8 12 pvpl 32 3531841 0 3512709 678 482 196 342 0 265 0 pmappl 216 8988 0 8966 2 0 2 2 0 8 0 extentpl 40 56 0 38 1 0 1 1 0 8 0 phpool 112 2308 0 1513 25 0 25 25 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(ffff800000e51800) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff8000299b0130) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff8000216f4030,ffff8000299b0240,ffff8000299b0290) at sys_ioctl+0x49e syscall(ffff8000299b0310) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffdda10, 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(ffff800000e51800) at tun_clone_destroy+0x234 sys/net/if_tun.c:315 if_clone_destroy(ffff8000299b0130) at if_clone_destroy+0x132 sys/net/if.c:1247 sys_ioctl(ffff8000216f4030,ffff8000299b0240,ffff8000299b0290) at sys_ioctl+0x49e syscall(ffff8000299b0310) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:625 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffdda10, count: -8