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 *389574 15790 0 0 0x4000000 0 syz-executor.4 374894 96255 0 0x2 0x480 1 syz-executor.3 db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:440 panic(ffffffff8257608c) at panic+0x177 sys/kern/subr_prf.c:202 __assert(ffffffff825ed4fc,ffffffff82634312,131,ffffffff825fed63) at __assert+0x25 sys/kern/subr_prf.c:161 tun_clone_destroy(ffff800000c66000) at tun_clone_destroy+0x278 sys/net/if_tun.c:305 if_clone_destroy(ffff8000211f6350) at if_clone_destroy+0x132 sys/net/if.c:1218 soo_ioctl(fffffd80659601c8,80206979,ffff8000211f6350,ffff80002add3510) at soo_ioctl+0x26c sys_ioctl(ffff80002add3510,ffff8000211f6468,ffff8000211f64c0) at sys_ioctl+0x4a2 syscall(ffff8000211f6530) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000211f6530) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x5785c3dbb50, 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(ffffffff8257608c) at panic+0x177 sys/kern/subr_prf.c:202 __assert(ffffffff825ed4fc,ffffffff82634312,131,ffffffff825fed63) at __assert+0x25 sys/kern/subr_prf.c:161 tun_clone_destroy(ffff800000c66000) at tun_clone_destroy+0x278 sys/net/if_tun.c:305 if_clone_destroy(ffff8000211f6350) at if_clone_destroy+0x132 sys/net/if.c:1218 soo_ioctl(fffffd80659601c8,80206979,ffff8000211f6350,ffff80002add3510) at soo_ioctl+0x26c sys_ioctl(ffff80002add3510,ffff8000211f6468,ffff8000211f64c0) at sys_ioctl+0x4a2 syscall(ffff8000211f6530) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000211f6530) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x5785c3dbb50, count: -9 ddb{0}> show registers rdi 0 rsi 0x1 rbp 0xffff8000211f6160 rbx 0xffffffff828f5bff cpu_info_full_primary+0x2bff rdx 0xffff800000bcdcc0 rcx 0 rax 0xffff80002add3510 r8 0 r9 0x8080808080808080 r10 0x9facc0d1ca921783 r11 0x1c7988fde63a1f6e r12 0xffffffff828f5a00 cpu_info_full_primary+0x2a00 r13 0 r14 0 r15 0x1 rip 0xffffffff81b7c538 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff8000211f6150 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.4) pid=389574 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffff80002af3a2a8,0xffff80002af3a558 process=0xffff80002add4870 user=0xffff8000211f1000, vmspace=0xfffffd805e18d8a8 estcpu=36, cpticks=2, pctcpu=0.0 user=0, sys=2, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 66923 477121 45178 0 2 0 syz-executor.0 4848 172344 96255 0 2 0 syz-executor.3 4848 448987 96255 0 3 0x4000080 fsleep syz-executor.3 4848 45131 96255 0 2 0x4000000 syz-executor.3 15790 213998 65292 0 2 0 syz-executor.4 *15790 389574 65292 0 7 0x4000000 syz-executor.4 2610 500067 52414 0 2 0 syz-executor.5 2610 285940 52414 0 3 0x4000080 fsleep syz-executor.5 48695 47978 60735 0 2 0x480 syz-executor.6 48695 321010 60735 0 3 0x4000080 netcon2 syz-executor.6 48695 346542 60735 0 3 0x4000080 fsleep syz-executor.6 48695 142784 60735 0 3 0x4000080 fsleep syz-executor.6 65292 435916 64302 0 2 0x482 syz-executor.4 96624 245110 0 0 3 0x14200 acct acct 76574 81086 64302 0 2 0x2 syz-executor.1 43192 255620 1 0 3 0x100083 ttyopn getty 45178 150128 64302 0 2 0x482 syz-executor.0 2499 469808 64302 0 2 0x2 syz-executor.2 96255 374894 64302 0 7 0x482 syz-executor.3 52414 28418 64302 0 2 0x482 syz-executor.5 60735 377496 64302 0 2 0x2 syz-executor.6 90320 118034 0 0 3 0x14280 nfsidl nfsio 12879 307590 0 0 3 0x14280 nfsidl nfsio 27846 265786 0 0 3 0x14280 nfsidl nfsio 80416 258492 0 0 3 0x14280 nfsidl nfsio 32682 216622 0 0 3 0x14280 nfsidl nfsio 21400 468288 0 0 3 0x14280 nfsidl nfsio 45452 271696 0 0 3 0x14280 nfsidl nfsio 29437 410887 0 0 3 0x14280 nfsidl nfsio 66243 351352 0 0 3 0x14280 nfsidl nfsio 27014 137034 0 0 3 0x14280 nfsidl nfsio 95602 429335 0 0 3 0x14280 nfsidl nfsio 92491 132365 0 0 3 0x14280 nfsidl nfsio 60038 456059 0 0 3 0x14280 nfsidl nfsio 85571 288252 0 0 3 0x14280 nfsidl nfsio 43381 313574 0 0 3 0x14280 nfsidl nfsio 33199 198898 0 0 3 0x14280 nfsidl nfsio 22002 97645 0 0 3 0x14280 nfsidl nfsio 3322 277700 0 0 3 0x14280 nfsidl nfsio 88589 195243 0 0 3 0x14280 nfsidl nfsio 33167 175721 0 0 3 0x14280 nfsidl nfsio 93207 225836 0 0 3 0x14200 bored sosplice 56726 367619 64302 0 2 0x2 syz-executor.7 64302 358407 1448 0 3 0x82 thrsleep syz-fuzzer 64302 409034 1448 0 3 0x4000082 thrsleep syz-fuzzer 64302 429608 1448 0 3 0x4000082 kqread syz-fuzzer 64302 47284 1448 0 3 0x4000082 thrsleep syz-fuzzer 64302 209488 1448 0 3 0x4000082 thrsleep syz-fuzzer 64302 265992 1448 0 3 0x4000082 thrsleep syz-fuzzer 64302 445882 1448 0 3 0x4000082 thrsleep syz-fuzzer 64302 369979 1448 0 3 0x4000082 thrsleep syz-fuzzer 1448 394191 88378 0 3 0x10008a sigsusp ksh 88378 54565 19067 0 3 0x9a kqread sshd 19067 45257 1 0 3 0x88 kqread sshd 27884 438752 8905 74 3 0x1100092 bpf pflogd 8905 295218 1 0 3 0x80 netio pflogd 43361 413142 37073 73 3 0x1100090 kqread syslogd 37073 173484 1 0 3 0x100082 netio syslogd 11623 519543 1 0 3 0x100080 kqread resolvd 31863 488309 4272 77 2 0x100092 dhcpleased 89671 174227 4272 77 3 0x100092 kqread dhcpleased 4272 181372 1 0 3 0x80 kqread dhcpleased 71892 196542 0 0 3 0x14200 bored smr 71431 141868 0 0 2 0x14200 zerothread 3536 170667 0 0 3 0x14200 aiodoned aiodoned 52719 489780 0 0 3 0x14200 syncer update 37112 259760 0 0 3 0x14200 cleaner cleaner 3031 301662 0 0 3 0x14200 reaper reaper 42368 459629 0 0 3 0x14200 pgdaemon pagedaemon 20400 463863 0 0 3 0x14200 bored viomb 58180 459148 0 0 3 0x40014200 acpi0 acpi0 74687 14573 0 0 3 0x40014200 idle1 82347 258069 0 0 3 0x14200 bored softnet 91982 480534 0 0 3 0x14200 bored systqmp 73131 187558 0 0 3 0x14200 bored systq 49538 434386 0 0 2 0x40014200 softclock 679 98695 0 0 3 0x40014200 idle0 1 165299 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 15790 (syz-executor.4) thread 0xffff80002add3510 (389574) exclusive rwlock clonelk r = 0 (0xffffffff8299e970) #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 (0xffffffff829eaf28) #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 Process 2499 (syz-executor.2) thread 0xffff80002add27f0 (469808) exclusive rrwlock inode r = 0 (0xfffffd8071872f78) #0 witness_lock+0x44d #1 rw_enter+0x3e1 sys/kern/kern_rwlock.c:310 #2 rrw_enter+0x8b sys/kern/kern_rwlock.c:461 #3 VOP_LOCK+0x87 sys/kern/vfs_vops.c:534 #4 ufs_ihashins+0x42 sys/ufs/ufs/ufs_ihash.c:140 #5 ffs_vget+0x141 sys/ufs/ffs/ffs_vfsops.c:1347 #6 ffs_inode_alloc+0x1be sys/ufs/ffs/ffs_alloc.c:394 #7 ufs_mkdir+0xf4 sys/ufs/ufs/ufs_vnops.c:1162 #8 VOP_MKDIR+0xbf sys/kern/vfs_vops.c:404 #9 domkdirat+0x121 sys/kern/vfs_syscalls.c:3101 #10 syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] #10 syscall+0x489 sys/arch/amd64/amd64/trap.c:585 #11 Xsyscall+0x128 exclusive rrwlock inode r = 0 (0xfffffd80719b5a38) #0 witness_lock+0x44d #1 rw_enter+0x3e1 sys/kern/kern_rwlock.c:310 #2 rrw_enter+0x8b sys/kern/kern_rwlock.c:461 #3 VOP_LOCK+0x87 sys/kern/vfs_vops.c:534 #4 vn_lock+0x84 sys/kern/vfs_vnops.c:579 #5 vfs_lookup+0xd1 sys/kern/vfs_lookup.c:413 #6 namei+0x36a sys/kern/vfs_lookup.c:245 #7 domkdirat+0x75 sys/kern/vfs_syscalls.c:3086 #8 syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] #8 syscall+0x489 sys/arch/amd64/amd64/trap.c:585 #9 Xsyscall+0x128 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 10213 6512K 7067K 78643K 26947 0 pcb 14 22K 27K 78643K 7163 0 rtable 226 14K 18K 78643K 2989 0 ifaddr 97 23K 26K 78643K 1736 0 sysctl 2 0K 0K 78643K 2 0 counters 56 35K 36K 78643K 512 0 ioctlops 0 0K 8K 78643K 3766 0 iov 0 0K 28K 78643K 1228 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 5 0 vnodes 1394 87K 87K 78643K 7396 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 3 5K 9K 78643K 118 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 0K 78643K 1837 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 15 53K 89K 78643K 11852 0 sigio 0 0K 0K 78643K 149 0 proc 73 87K 112K 78643K 2567 0 subproc 104 6K 6K 78643K 843 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 1064 0 in_multi 79 5K 6K 78643K 1058 0 ether_multi 1 0K 0K 78643K 116 0 mrt 1 0K 0K 78643K 57 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 217 970K 970K 78643K 217 0 exec 0 0K 2K 78643K 3004 0 pfkey data 0 0K 0K 78643K 2 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 558 921K 922K 78643K 150177 0 UVM aobj 131 8K 8K 78643K 131 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 614 0 NDP 13 0K 2K 78643K 392 0 temp 173 4781K 8877K 78643K 102415 0 kqueue 12 18K 24K 78643K 594 0 SYN cache 2 16K 16K 78643K 2 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 482 0 479 3 2 1 2 0 8 0 rtentry 112 863 0 778 4 0 4 4 0 8 0 unpcb 136 8113 0 8098 101 95 6 9 0 8 5 syncache 296 28 0 28 11 11 0 1 0 8 0 tcpqe 32 4 0 4 2 2 0 1 0 8 0 tcpcb 736 9594 0 9580 213 205 8 26 0 8 6 arp 120 138 0 123 1 0 1 1 0 8 0 inpcb 304 21593 0 21579 207 202 5 27 0 8 3 rttmr 72 19 0 19 5 5 0 1 0 8 0 ip6q 72 2 0 2 1 1 0 1 0 8 0 ip6af 40 6 0 6 1 1 0 1 0 8 0 nd6 48 225 0 202 1 0 1 1 0 8 0 pkpcb 40 44 0 44 12 12 0 1 0 8 0 kcovpl 48 64 0 56 1 0 1 1 0 8 0 ppxss 1248 95 0 95 17 16 1 1 0 8 1 pfstscr 40 15 0 15 2 2 0 1 0 8 0 pffrag 232 40 0 40 3 3 0 1 0 482 0 pffrnode 88 40 0 40 3 3 0 1 0 8 0 pffrent 40 248 0 248 3 3 0 1 0 8 0 pfosfp 40 1436 0 1011 5 0 5 5 0 8 0 pfosfpen 112 1436 0 720 21 0 21 21 0 8 0 pfrktable 1344 222 0 206 6 4 2 2 0 8 0 pftag 88 45 0 38 1 0 1 1 0 8 0 pfqueue 264 11 0 11 4 4 0 1 0 8 0 pfstitem 24 57 0 55 1 0 1 1 0 8 0 pfstkey 112 83 0 81 1 0 1 1 0 8 0 pfstate 320 66 0 64 2 1 1 2 0 8 0 pfrule 1360 671 0 558 11 1 10 10 0 8 0 art_heap8 4096 2 0 1 2 1 1 2 0 8 0 art_heap4 256 3562 0 3158 46 16 30 31 0 8 0 art_table 32 3564 0 3159 4 0 4 4 0 8 0 art_node 16 853 0 778 1 0 1 1 0 8 0 sysvmsgpl 40 42 0 2 1 0 1 1 0 8 0 semupl 112 3 0 3 1 1 0 1 0 8 0 semapl 112 1835 0 1825 1 0 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 17019 0 15529 94 0 94 94 0 8 0 ffsino 272 17019 0 15529 100 0 100 100 0 8 0 nchpl 144 32135 0 30508 63 0 63 63 0 8 0 uvmvnodes 80 6258 0 0 128 0 128 128 0 8 0 vnodes 224 6258 0 0 369 0 369 369 0 8 0 namei 1024 115339 0 115338 8 7 1 2 0 8 0 percpumem 16 268 0 228 1 0 1 1 0 8 0 vcpupl 2048 131 0 0 17 0 17 17 0 8 0 vmpool 560 179 0 48 10 0 10 10 0 8 0 pfiaddrpl 120 48 0 25 3 2 1 1 0 8 0 scsiplug 72 16 0 16 5 5 0 1 0 8 0 scxspl 216 102114 0 102114 24 22 2 8 0 8 2 plimitpl 152 1308 0 1293 1 0 1 1 0 8 0 sigapl 424 12070 0 12005 8 0 8 8 0 8 0 futexpl 64 98055 0 98051 6 5 1 1 0 8 0 knotepl 120 583 0 0 11 0 11 11 0 8 0 kqueuepl 216 2348 0 2340 51 48 3 5 0 8 2 pipepl 336 2205 0 2177 43 37 6 8 0 8 3 fdescpl 496 12030 0 12002 7 3 4 5 0 8 0 filepl 152 84938 0 84663 170 154 16 24 0 8 5 lockfpl 104 3425 0 3420 8 7 1 4 0 8 0 lockfspl 48 765 0 760 1 0 1 1 0 8 0 sessionpl 144 82 0 65 1 0 1 1 0 8 0 pgrppl 48 122 0 105 1 0 1 1 0 8 0 ucredpl 96 9946 0 9934 1 0 1 1 0 8 0 zombiepl 144 12006 0 12005 2 1 1 1 0 8 0 processpl 1064 12070 0 12005 5 0 5 5 0 8 0 procpl 672 34338 0 34259 28 19 9 9 0 8 1 srpgc 96 91 0 91 10 10 0 1 0 8 0 sosppl 168 75 0 75 14 14 0 1 0 8 0 sockpl 480 30250 0 30218 584 573 11 47 0 8 6 mcl64k 65536 42 0 0 4 1 3 3 0 8 0 mcl16k 16384 39 0 0 5 3 2 3 0 8 0 mcl12k 12288 25 0 0 2 0 2 2 0 8 0 mcl9k 9216 25 0 0 2 0 2 2 0 8 0 mcl8k 8192 33 0 0 5 2 3 3 0 8 0 mcl4k 4096 33 0 0 4 1 3 3 0 8 0 mcl2k2 2112 14 0 0 1 0 1 1 0 8 0 mcl2k 2048 303 0 0 19 1 18 19 0 8 0 mtagpl 96 814 0 0 11 0 11 11 0 8 0 mbufpl 256 1300 0 0 43 0 43 43 0 8 0 bufpl 288 22440 0 16104 453 0 453 453 0 8 0 anonpl 24 3553755 0 3534323 439 272 167 196 0 186 20 amapchunkpl 152 378710 0 377859 184 137 47 66 0 158 10 amappl16 200 39152 0 38508 229 190 39 58 0 8 0 amappl15 192 2154 0 2147 1 0 1 1 0 8 0 amappl14 184 1698 0 1691 1 0 1 1 0 8 0 amappl13 176 2477 0 2474 1 0 1 1 0 8 0 amappl12 168 975 0 969 1 0 1 1 0 8 0 amappl11 160 1076 0 1058 1 0 1 1 0 8 0 amappl10 152 1199 0 1188 1 0 1 1 0 8 0 amappl9 144 2540 0 2535 1 0 1 1 0 8 0 amappl8 136 2851 0 2715 5 0 5 5 0 8 0 amappl7 128 1325 0 1310 1 0 1 1 0 8 0 amappl6 120 2435 0 2407 2 1 1 2 0 8 0 amappl5 112 10673 0 10655 1 0 1 1 0 8 0 amappl4 104 4596 0 4556 3 1 2 2 0 8 0 amappl3 96 2805 0 2793 1 0 1 1 0 8 0 amappl2 88 3643 0 3577 3 1 2 3 0 8 0 amappl1 80 219499 0 218916 23 9 14 19 0 8 0 amappl 88 148476 0 148156 12 3 9 9 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 12209 0 12050 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 12209 0 12050 1 0 1 1 0 8 0 vmmpekpl 168 92020 0 91937 5 0 5 5 0 8 0 vmmpepl 168 1126351 0 1123292 381 231 150 165 0 357 0 vmsppl 368 12208 0 12050 16 1 15 15 0 8 0 rwobjpl 56 278022 0 269834 142 25 117 117 0 8 0 pdppl 4096 24425 0 24231 779 579 200 200 0 8 6 pvpl 32 5948125 0 5924119 762 478 284 332 0 265 67 pmappl 248 12208 0 12050 12 1 11 11 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 1868 0 857 29 0 29 29 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(ffffffff8257608c) at panic+0x177 sys/kern/subr_prf.c:202 __assert(ffffffff825ed4fc,ffffffff82634312,131,ffffffff825fed63) at __assert+0x25 sys/kern/subr_prf.c:161 tun_clone_destroy(ffff800000c66000) at tun_clone_destroy+0x278 sys/net/if_tun.c:305 if_clone_destroy(ffff8000211f6350) at if_clone_destroy+0x132 sys/net/if.c:1218 soo_ioctl(fffffd80659601c8,80206979,ffff8000211f6350,ffff80002add3510) at soo_ioctl+0x26c sys_ioctl(ffff80002add3510,ffff8000211f6468,ffff8000211f64c0) at sys_ioctl+0x4a2 syscall(ffff8000211f6530) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000211f6530) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x5785c3dbb50, count: -9 ddb{0}> machine ddbcpu 1