panic: kernel diagnostic assertion "sc->sc_dev == 0" failed: file "/syzkaller/managers/multicore/kernel/sys/net/if_tun.c", line 305 Stopped at db_enter+0x18: addq $0x8,%rsp TID PID UID PRFLAGS PFLAGS CPU COMMAND *253408 21875 0 0 0x4000000 0K syz-executor.0 db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:440 panic(ffffffff82579a90) at panic+0x177 sys/kern/subr_prf.c:202 __assert(ffffffff825ec6cc,ffffffff82633a76,131,ffffffff825feb3f) at __assert+0x25 sys/kern/subr_prf.c:161 tun_clone_destroy(ffff800000d2c000) at tun_clone_destroy+0x278 sys/net/if_tun.c:305 if_clone_destroy(ffff8000261a1640) at if_clone_destroy+0x132 sys/net/if.c:1218 soo_ioctl(fffffd80616705f8,80206979,ffff8000261a1640,ffff80002b321cf0) at soo_ioctl+0x26c sys_ioctl(ffff80002b321cf0,ffff8000261a1758,ffff8000261a17b0) at sys_ioctl+0x4a2 syscall(ffff8000261a1820) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000261a1820) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x95916c2f0d0, 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 305 ddb{0}> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:440 panic(ffffffff82579a90) at panic+0x177 sys/kern/subr_prf.c:202 __assert(ffffffff825ec6cc,ffffffff82633a76,131,ffffffff825feb3f) at __assert+0x25 sys/kern/subr_prf.c:161 tun_clone_destroy(ffff800000d2c000) at tun_clone_destroy+0x278 sys/net/if_tun.c:305 if_clone_destroy(ffff8000261a1640) at if_clone_destroy+0x132 sys/net/if.c:1218 soo_ioctl(fffffd80616705f8,80206979,ffff8000261a1640,ffff80002b321cf0) at soo_ioctl+0x26c sys_ioctl(ffff80002b321cf0,ffff8000261a1758,ffff8000261a17b0) at sys_ioctl+0x4a2 syscall(ffff8000261a1820) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000261a1820) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x95916c2f0d0, count: -9 ddb{0}> show registers rdi 0 rsi 0x1 rbp 0xffff8000261a1450 rbx 0xffffffff828ecbff cpu_info_full_primary+0x2bff rdx 0 rcx 0 rax 0xffff80002b321cf0 r8 0 r9 0x8080808080808080 r10 0x10a5146ce1314685 r11 0x5b66ff2d6b7f6b39 r12 0xffffffff828eca00 cpu_info_full_primary+0x2a00 r13 0 r14 0 r15 0x1 rip 0xffffffff82237da8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff8000261a1440 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.0) pid=253408 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=83, nice=20 forw=0xffffffffffffffff, list=0xffff80002b320d30,0xffffffff82af1e70 process=0xffff8000211a2578 user=0xffff80002619c000, vmspace=0xfffffd8073876760 estcpu=36, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 21875 480124 14596 0 2 0 syz-executor.0 *21875 253408 14596 0 7 0x4000000 syz-executor.0 17120 280844 65530 0 2 0 syz-executor.6 17120 472087 65530 0 3 0x4000080 fsleep syz-executor.6 27508 128894 16979 0 2 0 syz-executor.3 27508 213735 16979 0 3 0x4000080 fsleep syz-executor.3 47036 63222 6949 0 2 0 syz-executor.5 47036 67423 6949 0 3 0x4000080 netio syz-executor.5 47036 496993 6949 0 3 0x4000080 netlck syz-executor.5 11076 369407 15737 0 2 0 syz-executor.4 11076 454416 15737 0 3 0x4000080 fsleep syz-executor.4 11076 211712 15737 0 3 0x4000080 kqpoll syz-executor.4 13030 246718 83567 0 2 0 syz-executor.7 13030 290073 83567 0 3 0x4000080 fsleep syz-executor.7 13588 377331 26546 0 2 0 syz-executor.1 13588 263611 26546 0 3 0x4000080 fsleep syz-executor.1 13588 206579 26546 0 3 0x4000080 fsleep syz-executor.1 13588 215156 26546 0 3 0x4000080 fsleep syz-executor.1 15737 126864 73345 0 2 0x482 syz-executor.4 21732 242239 0 0 3 0x14280 nfsidl nfsio 90149 38540 0 0 3 0x14280 nfsidl nfsio 22970 215283 0 0 3 0x14280 nfsidl nfsio 22062 414215 0 0 3 0x14280 nfsidl nfsio 62146 195582 0 0 3 0x14280 nfsidl nfsio 10510 102487 0 0 3 0x14280 nfsidl nfsio 54671 390172 0 0 3 0x14280 nfsidl nfsio 21903 124471 0 0 3 0x14280 nfsidl nfsio 56076 334220 0 0 3 0x14280 nfsidl nfsio 94846 341675 0 0 3 0x14280 nfsidl nfsio 76155 282612 0 0 3 0x14280 nfsidl nfsio 92801 324125 0 0 3 0x14280 nfsidl nfsio 34681 503373 0 0 3 0x14280 nfsidl nfsio 21302 461853 0 0 3 0x14280 nfsidl nfsio 79846 371150 0 0 3 0x14280 nfsidl nfsio 67342 50355 0 0 3 0x14280 nfsidl nfsio 75098 277229 0 0 3 0x14280 nfsidl nfsio 94153 501761 0 0 3 0x14280 nfsidl nfsio 52674 251881 0 0 3 0x14280 nfsidl nfsio 63503 130534 0 0 3 0x14280 nfsidl nfsio 26546 34595 73345 0 2 0x482 syz-executor.1 16979 414983 73345 0 2 0x482 syz-executor.3 6949 45335 73345 0 3 0x82 nanoslp syz-executor.5 14596 120150 73345 0 2 0x482 syz-executor.0 83567 98346 73345 0 3 0x82 nanoslp syz-executor.7 65530 333270 73345 0 3 0x82 nanoslp syz-executor.6 31992 413607 1 0 3 0x100083 ttyin getty 28000 261738 73345 0 2 0x482 syz-executor.2 12232 370673 0 0 3 0x14200 acct acct 69339 147348 0 0 3 0x14200 bored sosplice 73345 155240 43216 0 3 0x82 thrsleep syz-fuzzer 73345 482273 43216 0 3 0x4000082 thrsleep syz-fuzzer 73345 252124 43216 0 3 0x4000082 thrsleep syz-fuzzer 73345 340757 43216 0 3 0x4000082 thrsleep syz-fuzzer 73345 371935 43216 0 3 0x4000082 thrsleep syz-fuzzer 73345 508767 43216 0 3 0x4000082 kqread syz-fuzzer 73345 378048 43216 0 3 0x4000082 thrsleep syz-fuzzer 73345 443920 43216 0 3 0x4000082 thrsleep syz-fuzzer 73345 358760 43216 0 3 0x4000082 thrsleep syz-fuzzer 43216 210548 60321 0 3 0x10008a sigsusp ksh 60321 118497 73404 0 3 0x9a kqread sshd 73404 274231 1 0 3 0x88 kqread sshd 16015 180810 67013 74 3 0x100092 bpf pflogd 67013 222743 1 0 3 0x80 netio pflogd 65037 465637 52442 73 3 0x100090 kqread syslogd 52442 53691 1 0 3 0x100082 netio syslogd 40733 330765 1 0 3 0x100080 kqread resolvd 88305 455183 1900 77 2 0x100092 dhcpleased 7986 223219 1900 77 3 0x100092 kqread dhcpleased 1900 209787 1 0 3 0x80 kqread dhcpleased 67499 348737 0 0 3 0x14200 bored smr 96361 363234 0 0 2 0x14200 zerothread 91188 111610 0 0 3 0x14200 aiodoned aiodoned 9517 410043 0 0 3 0x14200 syncer update 20274 273750 0 0 3 0x14200 cleaner cleaner 99404 39993 0 0 3 0x14200 reaper reaper 75975 411392 0 0 3 0x14200 pgdaemon pagedaemon 97229 156610 0 0 3 0x14200 bored viomb 48851 266335 0 0 3 0x40014200 acpi0 acpi0 51443 328810 0 0 7 0x40014200 idle1 78907 468783 0 0 3 0x14200 bored softnet 17847 155967 0 0 3 0x14200 bored systqmp 84595 62588 0 0 3 0x14200 bored systq 46765 383641 0 0 3 0x40014200 bored softclock 64552 197925 0 0 3 0x40014200 idle0 1 311633 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 21875 (syz-executor.0) thread 0xffff80002b321cf0 (253408) exclusive rwlock clonelk r = 0 (0xffffffff8298b730) #0 witness_lock+0x44d #1 if_clone_destroy+0x49 #2 soo_ioctl+0x26c #3 sys_ioctl+0x4a2 #4 syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] #4 syscall+0x489 sys/arch/amd64/amd64/trap.c:585 #5 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 0 (0xffffffff82ac44c8) #0 witness_lock+0x44d #1 soo_ioctl+0x25a sys/kern/sys_socket.c:136 #2 sys_ioctl+0x4a2 #3 syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] #3 syscall+0x489 sys/arch/amd64/amd64/trap.c:585 #4 Xsyscall+0x128 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 10233 6526K 14903K 78643K 84221 0 pcb 15 18K 23K 78643K 7924 0 rtable 256 25K 26K 78643K 7957 0 ifaddr 104 32K 40K 78643K 4414 0 sysctl 3 1K 1K 78643K 3 0 counters 58 35K 36K 78643K 1102 0 ioctlops 0 0K 4K 78643K 11163 0 iov 0 0K 32K 78643K 5654 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 5 0 vnodes 1509 94K 95K 78643K 27703 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 13K 78643K 513 0 VM map 2 1K 1K 78643K 2 0 sem 23 321K 331K 78643K 709 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 17 61K 93K 78643K 47388 0 sigio 0 0K 0K 78643K 1865 0 proc 75 87K 124K 78643K 6409 0 subproc 104 6K 10K 78643K 1966 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 3376 0 in_multi 82 5K 6K 78643K 3511 0 ether_multi 1 0K 0K 78643K 843 0 mrt 2 0K 0K 78643K 146 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 247 1102K 1102K 78643K 247 0 exec 0 0K 2K 78643K 10148 0 pfkey data 0 0K 1K 78643K 27 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 7 26K 26K 78643K 7 0 UVM amap 901 2250K 2255K 78643K 588530 0 UVM aobj 131 8K 8K 78643K 146 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 3079 0 NDP 14 0K 1K 78643K 847 0 temp 179 4783K 8857K 78643K 446318 0 kqueue 12 18K 28K 78643K 2251 0 SYN cache 2 8K 16K 78643K 3 0 ddb{0}> show all pools Name Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle plcache 128 22 0 0 1 0 1 1 0 8 0 rtpcb 120 3332 0 3329 45 44 1 5 0 8 0 rtentry 112 2042 0 1949 4 0 4 4 0 8 0 unpcb 136 28691 0 28674 287 282 5 9 0 8 4 syncache 296 96 0 96 29 29 0 1 0 8 0 tcpqe 32 42 8 42 20 20 0 1 0 8 0 tcpcb 736 17248 0 17238 496 493 3 20 0 8 2 arp 120 348 0 329 1 0 1 1 0 8 0 ipq 40 199 0 199 5 5 0 1 0 8 0 ipqe 40 398 0 398 5 5 0 1 0 8 0 inpcb 304 46117 0 46104 590 583 7 17 0 8 5 rttmr 72 17 0 17 6 6 0 1 0 8 0 nd6 48 473 0 453 1 0 1 1 0 8 0 pkpcb 40 290 0 290 24 24 0 1 0 8 0 kcovpl 48 138 0 130 1 0 1 1 0 8 0 ppxss 1248 213 0 213 49 49 0 1 0 8 0 pfstscr 40 87 0 87 11 11 0 1 0 8 0 pffrag 232 193 0 193 13 13 0 1 0 482 0 pffrnode 88 191 0 191 13 13 0 1 0 8 0 pffrent 40 1202 0 1202 14 14 0 1 0 8 0 pfosfp 40 1438 0 1012 5 0 5 5 0 8 0 pfosfpen 112 1438 0 716 21 0 21 21 0 8 0 pfrke_plain 168 8 0 8 4 4 0 1 0 8 0 pfrktable 1344 580 0 561 7 5 2 2 0 8 0 pftag 88 46 0 26 1 0 1 1 0 8 0 pfqueue 264 17 0 17 5 5 0 1 0 8 0 pfstitem 24 141 0 138 1 0 1 1 0 8 0 pfstkey 112 283 0 280 1 0 1 1 0 8 0 pfstate 320 203 0 200 3 2 1 3 0 8 0 pfrule 1360 1466 0 1285 22 6 16 16 0 8 0 art_heap8 4096 5 0 4 5 4 1 3 0 8 0 art_heap4 256 8144 0 7766 60 36 24 33 0 8 0 art_table 32 8149 0 7770 5 1 4 5 0 8 0 art_node 16 2028 0 1945 1 0 1 1 0 8 0 sysvmsgpl 40 51 0 19 1 0 1 1 0 8 0 semapl 112 699 0 678 1 0 1 1 0 8 0 shmpl 112 143 0 15 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 76823 0 75216 102 0 102 102 0 8 0 ffsino 272 76823 0 75216 108 0 108 108 0 8 0 nchpl 144 142541 0 140915 63 0 63 63 0 8 0 rtmask 32 16 0 16 4 4 0 1 0 8 0 uvmvnodes 80 7597 0 0 156 0 156 156 0 8 0 vnodes 224 7597 0 0 447 0 447 447 0 8 0 namei 1024 521881 0 521881 21 20 1 2 0 8 1 percpumem 16 563 0 522 1 0 1 1 0 8 0 vcpupl 2048 360 0 0 45 0 45 45 0 8 0 vmpool 560 512 0 152 30 4 26 26 0 8 0 pfiaddrpl 120 446 0 394 7 5 2 2 0 8 0 scsiplug 72 16 0 16 7 7 0 1 0 8 0 scxspl 216 407435 0 407435 57 56 1 8 0 8 1 plimitpl 152 5025 0 5010 1 0 1 1 0 8 0 sigapl 424 47568 0 47502 11 3 8 8 0 8 0 futexpl 64 491752 0 491745 10 9 1 1 0 8 0 knotepl 120 892 0 0 13 7 6 11 0 8 0 kqueuepl 216 12643 0 12634 254 253 1 8 0 8 0 pipepl 336 10434 0 10406 275 272 3 13 0 8 0 fdescpl 496 47419 0 47389 8 4 4 5 0 8 0 filepl 152 359246 0 358999 545 528 17 23 0 8 7 lockfpl 104 11565 0 11563 23 22 1 2 0 8 0 lockfspl 48 3677 0 3675 1 0 1 1 0 8 0 sessionpl 144 165 0 148 1 0 1 1 0 8 0 pgrppl 48 325 0 308 1 0 1 1 0 8 0 ucredpl 96 37655 0 37633 1 0 1 1 0 8 0 zombiepl 144 47502 0 47501 11 10 1 1 0 8 0 processpl 1064 47568 0 47501 6 1 5 5 0 8 0 procpl 672 126298 0 126212 47 39 8 9 0 8 0 srpgc 96 184 0 184 43 43 0 1 0 8 0 sosppl 168 328 0 328 63 62 1 1 0 8 1 sockpl 480 78583 0 78550 1719 1707 12 37 0 8 7 mcl64k 65536 25 0 0 3 0 3 3 0 8 0 mcl16k 16384 26 0 0 4 1 3 3 0 8 0 mcl12k 12288 17 0 0 2 0 2 2 0 8 0 mcl9k 9216 11 0 0 1 0 1 1 0 8 0 mcl8k 8192 18 0 0 3 0 3 3 0 8 0 mcl4k 4096 24 0 0 3 0 3 3 0 8 0 mcl2k2 2112 6 0 0 1 0 1 1 0 8 0 mcl2k 2048 655 0 0 21 2 19 21 0 8 0 mtagpl 96 2144 0 0 14 1 13 14 0 8 0 mbufpl 256 5762 0 0 296 1 295 295 0 8 0 bufpl 288 85783 0 78184 543 0 543 543 0 8 0 anonpl 24 13346688 0 13320193 824 639 185 199 0 186 2 amapchunkpl 152 1463748 0 1462811 310 264 46 50 0 158 8 amappl16 200 131997 0 130761 533 455 78 78 0 8 6 amappl15 192 7363 0 7358 1 0 1 1 0 8 0 amappl14 184 6906 0 6900 1 0 1 1 0 8 0 amappl13 176 6032 0 6025 1 0 1 1 0 8 0 amappl12 168 6061 0 6051 1 0 1 1 0 8 0 amappl11 160 4427 0 4412 1 0 1 1 0 8 0 amappl10 152 5925 0 5909 1 0 1 1 0 8 0 amappl9 144 8394 0 8391 1 0 1 1 0 8 0 amappl8 136 8663 0 8413 10 1 9 9 0 8 0 amappl7 128 5194 0 5178 1 0 1 1 0 8 0 amappl6 120 8536 0 8496 4 2 2 2 0 8 0 amappl5 112 44588 0 44568 1 0 1 1 0 8 0 amappl4 104 13081 0 13035 2 0 2 2 0 8 0 amappl3 96 12284 0 12266 1 0 1 1 0 8 0 amappl2 88 12436 0 12344 14 11 3 3 0 8 0 amappl1 80 850395 0 849779 26 12 14 19 0 8 0 amappl 88 584333 0 583880 13 2 11 11 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 145 0 15 3 0 3 3 0 8 0 uaddrrnd 24 47931 0 47541 3 0 3 3 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 47931 0 47541 3 0 3 3 0 8 0 vmmpekpl 168 317034 0 316926 6 0 6 6 0 8 0 vmmpepl 168 4392274 0 4387990 1098 888 210 225 0 357 12 vmsppl 368 47930 0 47541 42 6 36 36 0 8 0 rwobjpl 56 1026328 0 1015926 229 78 151 151 0 8 4 pdppl 4096 95869 0 95442 2186 1757 429 430 0 8 2 pvpl 32 21816398 0 21792729 1148 918 230 251 0 265 5 pmappl 248 47930 0 47541 26 1 25 25 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 4241 0 2600 50 2 48 48 0 8 0 ddb{0}> machine ddbcpu 0 Invalid cpu 0 ddb{0}> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:440 panic(ffffffff82579a90) at panic+0x177 sys/kern/subr_prf.c:202 __assert(ffffffff825ec6cc,ffffffff82633a76,131,ffffffff825feb3f) at __assert+0x25 sys/kern/subr_prf.c:161 tun_clone_destroy(ffff800000d2c000) at tun_clone_destroy+0x278 sys/net/if_tun.c:305 if_clone_destroy(ffff8000261a1640) at if_clone_destroy+0x132 sys/net/if.c:1218 soo_ioctl(fffffd80616705f8,80206979,ffff8000261a1640,ffff80002b321cf0) at soo_ioctl+0x26c sys_ioctl(ffff80002b321cf0,ffff8000261a1758,ffff8000261a17b0) at sys_ioctl+0x4a2 syscall(ffff8000261a1820) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000261a1820) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x95916c2f0d0, count: -9 ddb{0}> machine ddbcpu 1 Stopped at x86_ipi_db+0x1a: addq $0x8,%rsp x86_ipi_db(ffff800020ce8ff0) at x86_ipi_db+0x1a sys/arch/amd64/amd64/db_interface.c:393 x86_ipi_handler() at x86_ipi_handler+0xb7 sys/arch/amd64/amd64/ipi.c:106 Xresume_lapic_ipi() at Xresume_lapic_ipi+0x23 acpicpu_idle() at acpicpu_idle+0x312 sys/dev/acpi/acpicpu.c:1206 sched_idle(ffff800020ce8ff0) at sched_idle+0x417 sys/kern/kern_sched.c:178 end trace frame: 0x0, count: 10 ddb{1}> trace x86_ipi_db(ffff800020ce8ff0) at x86_ipi_db+0x1a sys/arch/amd64/amd64/db_interface.c:393 x86_ipi_handler() at x86_ipi_handler+0xb7 sys/arch/amd64/amd64/ipi.c:106 Xresume_lapic_ipi() at Xresume_lapic_ipi+0x23 acpicpu_idle() at acpicpu_idle+0x312 sys/dev/acpi/acpicpu.c:1206 sched_idle(ffff800020ce8ff0) at sched_idle+0x417 sys/kern/kern_sched.c:178 end trace frame: 0x0, count: -5