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 *213934 19685 0 0 0x4000000 0K syz-executor.4 db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:440 panic(ffffffff825739a5) at panic+0x177 sys/kern/subr_prf.c:202 __assert(ffffffff825e91ae,ffffffff82632dac,131,ffffffff825fdeb9) at __assert+0x25 sys/kern/subr_prf.c:161 tun_clone_destroy(ffff800000c27800) at tun_clone_destroy+0x278 sys/net/if_tun.c:305 if_clone_destroy(ffff80002e464fd0) at if_clone_destroy+0x132 sys/net/if.c:1218 soo_ioctl(fffffd8067abcc90,80206979,ffff80002e464fd0,ffff8000238557a8) at soo_ioctl+0x26c sys_ioctl(ffff8000238557a8,ffff80002e4650e8,ffff80002e465140) at sys_ioctl+0x4a2 syscall(ffff80002e4651b0) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002e4651b0) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xcb4a80cd490, 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(ffffffff825739a5) at panic+0x177 sys/kern/subr_prf.c:202 __assert(ffffffff825e91ae,ffffffff82632dac,131,ffffffff825fdeb9) at __assert+0x25 sys/kern/subr_prf.c:161 tun_clone_destroy(ffff800000c27800) at tun_clone_destroy+0x278 sys/net/if_tun.c:305 if_clone_destroy(ffff80002e464fd0) at if_clone_destroy+0x132 sys/net/if.c:1218 soo_ioctl(fffffd8067abcc90,80206979,ffff80002e464fd0,ffff8000238557a8) at soo_ioctl+0x26c sys_ioctl(ffff8000238557a8,ffff80002e4650e8,ffff80002e465140) at sys_ioctl+0x4a2 syscall(ffff80002e4651b0) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002e4651b0) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xcb4a80cd490, count: -9 ddb{0}> show registers rdi 0 rsi 0x1 rbp 0xffff80002e464de0 rbx 0xffffffff82920bff cpu_info_full_primary+0x2bff rdx 0xffff800000ca5180 rcx 0 rax 0xffff8000238557a8 r8 0 r9 0x8080808080808080 r10 0x672bce807bc90599 r11 0x798a8735cfb508d9 r12 0xffffffff82920a00 cpu_info_full_primary+0x2a00 r13 0 r14 0 r15 0x1 rip 0xffffffff8147cfe8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff80002e464dd0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.4) pid=213934 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffff800023855508,0xffff800023855278 process=0xffff80002e4754f0 user=0xffff80002e460000, vmspace=0xfffffd806edbc008 estcpu=36, cpticks=2, pctcpu=0.0 user=0, sys=2, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 62188 17188 2451 0 2 0 syz-executor.5 67741 218685 92602 0 2 0 syz-executor.6 67741 277746 92602 0 3 0x4000080 fsleep syz-executor.6 86104 187050 26390 0 2 0 syz-executor.7 86104 254749 26390 0 3 0x4000080 fsleep syz-executor.7 19685 244039 62755 0 2 0 syz-executor.4 *19685 213934 62755 0 7 0x4000000 syz-executor.4 33092 339969 31542 0 2 0x480 syz-executor.0 33092 405605 31542 0 3 0x4000080 kqread syz-executor.0 33092 56439 31542 0 3 0x4000080 fsleep syz-executor.0 33710 260620 41168 0 2 0 syz-executor.1 33710 396385 41168 0 3 0x4000080 fsleep syz-executor.1 22936 456313 0 0 3 0x14280 nfsidl nfsio 26539 14816 0 0 3 0x14280 nfsidl nfsio 4986 39338 0 0 3 0x14280 nfsidl nfsio 3231 380045 0 0 3 0x14280 nfsidl nfsio 723 523457 0 0 3 0x14280 nfsidl nfsio 12859 394841 0 0 3 0x14280 nfsidl nfsio 26818 21455 0 0 3 0x14280 nfsidl nfsio 46481 98740 0 0 3 0x14280 nfsidl nfsio 70512 515527 0 0 3 0x14280 nfsidl nfsio 21833 484268 0 0 3 0x14280 nfsidl nfsio 8020 406919 0 0 3 0x14280 nfsidl nfsio 97669 449062 0 0 3 0x14280 nfsidl nfsio 43465 347817 0 0 3 0x14280 nfsidl nfsio 26730 38298 0 0 3 0x14280 nfsidl nfsio 13653 501979 0 0 3 0x14280 nfsidl nfsio 89921 180443 0 0 3 0x14280 nfsidl nfsio 98409 261727 0 0 3 0x14280 nfsidl nfsio 16233 211448 0 0 3 0x14280 nfsidl nfsio 18764 238951 0 0 3 0x14280 nfsidl nfsio 39841 39052 0 0 3 0x14280 nfsidl nfsio 31940 238768 0 0 3 0x14200 acct acct 31542 246618 27474 0 2 0x482 syz-executor.0 5527 329319 27474 0 2 0x2 syz-executor.2 26390 494811 27474 0 2 0x482 syz-executor.7 92602 259680 27474 0 2 0x482 syz-executor.6 27484 325783 1 0 3 0x100083 ttyin getty 41168 55982 27474 0 2 0x482 syz-executor.1 33591 319529 27474 0 2 0x482 syz-executor.3 62755 45199 27474 0 2 0x482 syz-executor.4 2451 309992 27474 0 2 0x482 syz-executor.5 31371 386417 0 0 3 0x14200 bored sosplice 27474 274360 87342 0 2 0x482 syz-fuzzer 27474 371218 87342 0 2 0x4000482 syz-fuzzer 27474 430658 87342 0 3 0x4000082 thrsleep syz-fuzzer 27474 343074 87342 0 3 0x4000082 thrsleep syz-fuzzer 27474 396688 87342 0 3 0x4000082 kqread syz-fuzzer 27474 131673 87342 0 3 0x4000082 thrsleep syz-fuzzer 27474 52543 87342 0 3 0x4000082 thrsleep syz-fuzzer 27474 382278 87342 0 3 0x4000082 thrsleep syz-fuzzer 27474 498705 87342 0 3 0x4000082 thrsleep syz-fuzzer 87342 125674 83988 0 3 0x10008a sigsusp ksh 83988 352235 55362 0 3 0x9a kqread sshd 55362 128833 1 0 3 0x88 kqread sshd 70039 105380 85732 74 3 0x100092 bpf pflogd 85732 243803 1 0 3 0x80 netio pflogd 92144 17317 16176 73 3 0x100090 kqread syslogd 16176 391754 1 0 3 0x100082 netio syslogd 18499 468855 1 0 3 0x100080 kqread resolvd 26279 358031 32153 77 2 0x100092 dhcpleased 96607 414397 32153 77 3 0x100092 kqread dhcpleased 32153 131980 1 0 3 0x80 kqread dhcpleased 21105 484783 0 0 3 0x14200 bored smr 27991 34815 0 0 2 0x14200 zerothread 65165 230182 0 0 3 0x14200 aiodoned aiodoned 47562 241345 0 0 3 0x14200 syncer update 42671 251905 0 0 3 0x14200 cleaner cleaner 94895 31065 0 0 3 0x14200 reaper reaper 24727 53570 0 0 3 0x14200 pgdaemon pagedaemon 61997 494412 0 0 3 0x14200 bored viomb 25237 479647 0 0 3 0x40014200 acpi0 acpi0 14783 265802 0 0 7 0x40014200 idle1 6714 231083 0 0 3 0x14200 bored softnet 156 127390 0 0 3 0x14200 bored systqmp 37360 323221 0 0 3 0x14200 bored systq 6572 194250 0 0 2 0x40014200 softclock 80139 410459 0 0 3 0x40014200 idle0 1 460679 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 19685 (syz-executor.4) thread 0xffff8000238557a8 (213934) exclusive rwlock clonelk r = 0 (0xffffffff828e4a20) #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 (0xffffffff82a3d4a8) #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 10230 6565K 7607K 78643K 72037 0 pcb 15 22K 26K 78643K 2546 0 rtable 312 36K 38K 78643K 7221 0 ifaddr 122 27K 28K 78643K 4520 0 sysctl 3 1K 1K 78643K 3 0 counters 58 35K 36K 78643K 274 0 ioctlops 0 0K 8K 78643K 9031 0 iov 0 0K 32K 78643K 1122 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 5 0 vnodes 1563 98K 98K 78643K 18855 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 9K 78643K 107 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 0K 78643K 1358 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 16 57K 89K 78643K 14342 0 sigio 0 0K 0K 78643K 133 0 proc 70 87K 112K 78643K 2420 0 subproc 104 6K 6K 78643K 719 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 1204 0 in_multi 79 5K 6K 78643K 1159 0 ether_multi 1 0K 0K 78643K 126 0 mrt 2 0K 0K 78643K 55 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 277 1235K 1235K 78643K 277 0 exec 0 0K 2K 78643K 3432 0 pfkey data 0 0K 0K 78643K 104 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 584 934K 948K 78643K 179242 0 UVM aobj 131 5K 5K 78643K 139 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 824 0 NDP 14 0K 2K 78643K 286 0 temp 170 4761K 8857K 78643K 140168 0 kqueue 13 20K 30K 78643K 1680 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 1124 0 1121 15 14 1 3 0 8 0 rtentry 112 940 0 842 5 1 4 4 0 8 0 unpcb 136 9950 0 9935 111 109 2 9 0 8 1 syncache 296 19 0 19 6 6 0 1 0 8 0 tcpqe 32 5 0 5 2 2 0 1 0 8 0 tcpcb 736 8163 0 8152 182 174 8 19 0 8 6 arp 120 131 0 111 1 0 1 1 0 8 0 inpcb 304 20540 0 20525 200 193 7 16 0 8 5 rttmr 72 18 0 18 5 5 0 1 0 8 0 nd6 48 250 0 226 1 0 1 1 0 8 0 pkpcb 40 52 0 52 5 5 0 1 0 8 0 kcovpl 48 55 0 47 1 0 1 1 0 8 0 ppxss 1248 52 0 52 15 15 0 1 0 8 0 pfstscr 40 34 0 34 7 6 1 1 0 8 1 pffrag 232 88 0 87 6 5 1 1 0 482 0 pffrnode 88 88 0 87 6 5 1 1 0 8 0 pffrent 40 352 0 351 6 5 1 1 0 8 0 pfosfp 40 1435 0 1010 5 0 5 5 0 8 0 pfosfpen 112 1435 0 714 21 0 21 21 0 8 0 pfrke_plain 168 748 0 748 2 2 0 1 0 8 0 pfrktable 1344 1954 0 1915 5 1 4 4 0 8 0 pftag 88 13 0 6 1 0 1 1 0 8 0 pfqueue 264 8 0 5 2 1 1 1 0 8 0 pfstitem 24 112 0 110 1 0 1 1 0 8 0 pfstkey 112 152 0 150 1 0 1 1 0 8 0 pfstate 320 128 0 126 4 3 1 3 0 8 0 pfrule 1360 2136 0 1941 18 1 17 17 0 8 0 art_heap8 4096 4 0 3 4 3 1 3 0 8 0 art_heap4 256 4222 0 3827 48 20 28 31 0 8 0 art_table 32 4226 0 3830 4 0 4 4 0 8 0 art_node 16 898 0 811 1 0 1 1 0 8 0 sysvmsgpl 40 50 0 10 1 0 1 1 0 8 0 semupl 112 3 0 3 1 1 0 1 0 8 0 semapl 112 1356 0 1346 1 0 1 1 0 8 0 shmpl 112 136 0 8 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 20197 0 18726 93 0 93 93 0 8 0 ffsino 272 20197 0 18726 99 0 99 99 0 8 0 nchpl 144 38275 0 36648 63 0 63 63 0 8 0 rtmask 32 1488 0 1488 2 2 0 1 0 8 0 uvmvnodes 80 5926 0 0 121 0 121 121 0 8 0 vnodes 224 5926 0 0 349 0 349 349 0 8 0 namei 1024 143686 0 143686 6 5 1 2 0 8 1 percpumem 16 149 0 108 1 0 1 1 0 8 0 vcpupl 2048 161 0 0 21 0 21 21 0 8 0 vmpool 560 170 0 9 12 0 12 12 0 8 0 pfiaddrpl 120 1389 0 1297 9 6 3 3 0 8 0 scsiplug 72 8 0 8 3 3 0 1 0 8 0 scxspl 216 111514 0 111514 29 28 1 8 0 8 1 plimitpl 152 1617 0 1602 1 0 1 1 0 8 0 sigapl 424 14616 0 14551 12 4 8 8 0 8 0 futexpl 64 154733 0 154729 5 4 1 1 0 8 0 knotepl 120 326 0 0 7 1 6 6 0 8 0 kqueuepl 216 5322 0 5313 86 81 5 12 0 8 4 pipepl 336 3186 0 3158 89 81 8 9 0 8 5 fdescpl 496 14538 0 14509 7 3 4 5 0 8 0 filepl 152 111112 0 110864 196 178 18 24 0 8 8 lockfpl 104 3393 0 3391 5 4 1 2 0 8 0 lockfspl 48 989 0 987 1 0 1 1 0 8 0 sessionpl 144 75 0 58 1 0 1 1 0 8 0 pgrppl 48 180 0 163 1 0 1 1 0 8 0 ucredpl 96 14037 0 14025 1 0 1 1 0 8 0 zombiepl 144 14551 0 14550 5 4 1 1 0 8 0 processpl 1064 14616 0 14550 6 1 5 5 0 8 0 procpl 672 39369 0 39289 15 7 8 9 0 8 0 srpgc 96 54 0 54 10 10 0 1 0 8 0 sosppl 168 158 0 158 22 22 0 1 0 8 0 sockpl 480 31680 0 31647 646 634 12 37 0 8 7 mcl64k 65536 20 0 0 3 0 3 3 0 8 0 mcl16k 16384 16 0 0 2 0 2 2 0 8 0 mcl12k 12288 25 0 0 2 0 2 2 0 8 0 mcl9k 9216 20 0 0 2 0 2 2 0 8 0 mcl8k 8192 30 0 0 4 1 3 3 0 8 0 mcl4k 4096 18 0 0 3 0 3 3 0 8 0 mcl2k2 2112 10 0 0 1 0 1 1 0 8 0 mcl2k 2048 507 0 0 27 0 27 27 0 8 0 mtagpl 96 2079 0 0 37 0 37 37 0 8 0 mbufpl 256 2390 0 0 110 0 110 110 0 8 0 bufpl 288 26511 0 20176 453 0 453 453 0 8 0 anonpl 24 4100946 0 4076908 394 232 162 184 0 186 0 amapchunkpl 152 440173 0 439260 162 122 40 50 0 158 2 amappl16 200 42076 0 41115 245 193 52 61 0 8 1 amappl15 192 1231 0 1224 1 0 1 1 0 8 0 amappl14 184 1048 0 1045 1 0 1 1 0 8 0 amappl13 176 1930 0 1926 1 0 1 1 0 8 0 amappl12 168 2240 0 2237 1 0 1 1 0 8 0 amappl11 160 844 0 825 1 0 1 1 0 8 0 amappl10 152 1413 0 1404 1 0 1 1 0 8 0 amappl9 144 4278 0 4275 1 0 1 1 0 8 0 amappl8 136 3702 0 3575 8 3 5 5 0 8 0 amappl7 128 2265 0 2251 1 0 1 1 0 8 0 amappl6 120 4183 0 4154 2 1 1 2 0 8 0 amappl5 112 14800 0 14775 1 0 1 1 0 8 0 amappl4 104 3340 0 3303 5 4 1 2 0 8 0 amappl3 96 3540 0 3525 1 0 1 1 0 8 0 amappl2 88 3536 0 3472 3 1 2 3 0 8 0 amappl1 80 261087 0 260487 19 5 14 19 0 8 0 amappl 88 177709 0 177366 14 5 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 138 0 8 3 0 3 3 0 8 0 uaddrrnd 24 14708 0 14518 2 0 2 2 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 14708 0 14518 2 0 2 2 0 8 0 vmmpekpl 168 105762 0 105683 5 0 5 5 0 8 0 vmmpepl 168 1332684 0 1329246 415 257 158 194 0 357 2 vmsppl 368 14707 0 14518 19 1 18 18 0 8 0 rwobjpl 56 321289 0 313094 148 31 117 118 0 8 0 pdppl 4096 29423 0 29197 827 597 230 231 0 8 4 pvpl 32 6855195 0 6828943 615 383 232 300 0 265 0 pmappl 248 14707 0 14518 12 0 12 12 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 2014 0 885 33 0 33 33 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(ffffffff825739a5) at panic+0x177 sys/kern/subr_prf.c:202 __assert(ffffffff825e91ae,ffffffff82632dac,131,ffffffff825fdeb9) at __assert+0x25 sys/kern/subr_prf.c:161 tun_clone_destroy(ffff800000c27800) at tun_clone_destroy+0x278 sys/net/if_tun.c:305 if_clone_destroy(ffff80002e464fd0) at if_clone_destroy+0x132 sys/net/if.c:1218 soo_ioctl(fffffd8067abcc90,80206979,ffff80002e464fd0,ffff8000238557a8) at soo_ioctl+0x26c sys_ioctl(ffff8000238557a8,ffff80002e4650e8,ffff80002e465140) at sys_ioctl+0x4a2 syscall(ffff80002e4651b0) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002e4651b0) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xcb4a80cd490, 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