panic: kernel diagnostic assertion "sc->sc_dev == 0" failed: file "/syzkaller/managers/setuid/kernel/sys/net/if_tun.c", line 315 Stopped at db_enter+0x25: addq $0x8,%rsp TID PID UID PRFLAGS PFLAGS CPU COMMAND 32816 5807 0 0x2 0 1 ndp *343344 88681 0 0x2 0 0K ifconfig db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff830e2a3c) at panic+0x1e5 sys/kern/subr_prf.c:198 __assert(ffffffff8309aa14,ffffffff830e2535,13b,ffffffff8307948d) at __assert+0x29 tun_clone_destroy(ffff80000158b000) at tun_clone_destroy+0x38a sys/net/if_tun.c:315 if_clone_destroy(ffff8000371cf210) at if_clone_destroy+0x1d7 sys/net/if.c:1384 ifioctl(ffff800010fdda00,80206979,ffff8000371cf210,ffff800029fe7240) at ifioctl+0x5c5 sys_ioctl(ffff800029fe7240,ffff8000371cf3f0,ffff8000371cf340) at sys_ioctl+0x67c syscall(ffff8000371cf3f0) at syscall+0xbb6 mi_syscall sys/sys/syscall_mi.h:179 [inline] syscall(ffff8000371cf3f0) at syscall+0xbb6 sys/arch/amd64/amd64/trap.c:577 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7bf5f72104b0, 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/setuid/kernel/sys/net/if_tun.c", line 315 ddb{0}> trace db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff830e2a3c) at panic+0x1e5 sys/kern/subr_prf.c:198 __assert(ffffffff8309aa14,ffffffff830e2535,13b,ffffffff8307948d) at __assert+0x29 tun_clone_destroy(ffff80000158b000) at tun_clone_destroy+0x38a sys/net/if_tun.c:315 if_clone_destroy(ffff8000371cf210) at if_clone_destroy+0x1d7 sys/net/if.c:1384 ifioctl(ffff800010fdda00,80206979,ffff8000371cf210,ffff800029fe7240) at ifioctl+0x5c5 sys_ioctl(ffff800029fe7240,ffff8000371cf3f0,ffff8000371cf340) at sys_ioctl+0x67c syscall(ffff8000371cf3f0) at syscall+0xbb6 mi_syscall sys/sys/syscall_mi.h:179 [inline] syscall(ffff8000371cf3f0) at syscall+0xbb6 sys/arch/amd64/amd64/trap.c:577 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7bf5f72104b0, count: -9 ddb{0}> show registers rdi 0 rsi 0x1 rbp 0xffff8000371cefc0 rbx 0xffffffff83470d87 cpu_info_full_primary+0x2d87 rdx 0 rcx 0xffff800029fe7240 rax 0xffffffff8346fff0 cpu_info_full_primary+0x1ff0 r8 0x101010101010101 r9 0x8080808080808080 r10 0xbcce80cd692f2782 r11 0xeb7213da7cea08f0 r12 0xffffffff83470b88 cpu_info_full_primary+0x2b88 r13 0 r14 0 r15 0x1 rip 0xffffffff820f2715 db_enter+0x25 cs 0x8 rflags 0x246 rsp 0xffff8000371cefb0 ss 0x10 db_enter+0x25: addq $0x8,%rsp ddb{0}> show proc PROC (ifconfig) tid=343344 pid=88681 tcnt=1 stat=onproc flags process=2 proc=0 runpri=51, usrpri=52, slppri=32, nice=20 wchan=0x0, wmesg=, ps_single=0x0 scnt=0 ecnt=0 forw=0xffffffffffffffff, list=0xffff800029fe6820,0xffff800029fe6ab8 process=0xffff8000371d0930 user=0xffff8000371ca000, vmspace=0xfffffd80789426e0 estcpu=2, cpticks=2, pctcpu=0.0, user=0, sys=1, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 3425 365312 63748 0 2 0x40 syz-executor 5807 32816 67738 0 7 0x2 ndp 67738 260668 48200 0 3 0x10008a sigsusp sh 58962 408731 87698 0 2 0x2 ifconfig *88681 343344 76538 0 7 0x2 ifconfig 95468 62403 5554 0 2 0x100002 sh 87698 127207 77448 0 3 0x10008a sigsusp sh 76538 69486 51523 0 3 0x10008a sigsusp sh 74696 384381 75419 32767 2 0x10 syz-executor 74696 463743 75419 32767 3 0x4000090 fsleep syz-executor 51523 266218 54955 0 3 0x80 wait syz-executor 55339 85071 73421 32767 2 0x10 syz-executor 55339 44286 73421 32767 3 0x4000090 fsleep syz-executor 54955 383831 29731 0 3 0x82 wait syz-executor 77448 475328 42848 0 3 0x80 wait syz-executor 4171 253425 58235 32767 2 0x10 syz-executor 4171 498069 58235 32767 3 0x4000090 sbwait syz-executor 4171 154100 58235 32767 3 0x4000090 fsleep syz-executor 4171 515322 58235 32767 3 0x4000090 fsleep syz-executor 42848 414384 29731 0 3 0x82 wait syz-executor 48200 46671 52045 0 3 0x80 wait syz-executor 52045 81724 29731 0 3 0x82 wait syz-executor 5554 55624 93942 0 3 0x80 wait syz-executor 63748 523534 57647 0 3 0x80 ppwait syz-executor 57647 31835 29731 0 3 0x82 wait syz-executor 93942 485969 29731 0 3 0x82 wait syz-executor 58235 247284 88773 32767 3 0x90 nanoslp syz-executor 73421 507430 39158 32767 3 0x90 nanoslp syz-executor 88773 229895 29731 0 3 0x82 wait syz-executor 39158 501521 29731 0 3 0x82 wait syz-executor 75419 148525 57842 32767 2 0x490 syz-executor 57842 192409 29731 0 3 0x82 wait syz-executor 55030 161955 38956 32767 4 0x82010 syz-executor 55030 214654 38956 32767 2 0x4082010 syz-executor 55030 105250 38956 32767 3 0x4002010 suspend syz-executor 38956 108770 1 32767 3 0x90 wait syz-executor 36477 394807 13252 0 2 0x100002 arp 13252 26243 98876 0 3 0x10008a sigsusp sh 98876 355309 1 0 3 0x80 wait syz-executor 89545 339660 24120 0 3 0x100082 sbwait ndp 24120 335369 25538 0 3 0x10008a sigsusp sh 25538 46574 1 0 3 0x80 wait syz-executor 92198 407702 8498 0 3 0x100082 sbwait arp 8498 153375 79617 0 3 0x10008a sigsusp sh 79617 292769 1 0 3 0x80 wait syz-executor 25507 317252 0 0 3 0x14200 bored sosplice 29731 443108 87020 0 3 0x82 kqread syz-executor 87020 242572 98132 0 3 0x10008a sigsusp ksh 98132 437980 7619 0 3 0x98 kqread sshd-session 7619 170027 24833 0 3 0x92 kqread sshd-session 95405 63653 1 0 3 0x100083 ttyin getty 24833 53708 1 0 3 0x88 kqread sshd 22053 355743 44063 73 3 0x1100090 kqread syslogd 44063 74485 1 0 3 0x100082 sbwait syslogd 96036 237605 1 0 3 0x100080 kqread resolvd 46334 223644 25030 77 2 0x100092 dhcpleased 56048 80261 25030 77 3 0x100092 kqread dhcpleased 25030 346629 1 0 3 0x80 kqread dhcpleased 2413 421641 0 0 3 0x14200 bored smr 46805 464142 0 0 2 0x14200 zerothread 70609 498603 0 0 3 0x14200 aiodoned aiodoned 8970 138706 0 0 3 0x14200 syncer update 46046 519229 0 0 3 0x14200 cleaner cleaner 34366 509993 0 0 3 0x14200 reaper reaper 87321 110431 0 0 3 0x14200 pgdaemon pagedaemon 79077 197381 0 0 3 0x14200 bored viomb 97809 454189 0 0 3 0x40014200 acpi0 acpi0 65249 110722 0 0 3 0x40014200 idle1 64834 353540 0 0 3 0x14200 bored softnet3 55853 276229 0 0 3 0x14200 bored softnet2 67391 260155 0 0 3 0x14200 bored softnet1 65168 75668 0 0 3 0x14200 bored softnet0 76381 229890 0 0 3 0x14200 bored systqmp 34203 413919 0 0 3 0x14200 bored systq 60011 162146 0 0 3 0x14200 tmoslp softclockmp 82876 477266 0 0 3 0x40014200 tmoslp softclock 9857 324360 0 0 3 0x40014200 idle0 1 307613 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 88681 (ifconfig) thread 0xffff800029fe7240 (343344) exclusive rwlock clonelk r = 0 (0xffffffff8347ed30) #0 witness_lock+0x5b8 stacktrace_save sys/sys/stacktrace.h:37 [inline] #0 witness_lock+0x5b8 sys/kern/subr_witness.c:1151 #1 if_clone_destroy+0x67 #2 ifioctl+0x5c5 #3 sys_ioctl+0x67c #4 syscall+0xbb6 mi_syscall sys/sys/syscall_mi.h:179 [inline] #4 syscall+0xbb6 sys/arch/amd64/amd64/trap.c:577 #5 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 0 (0xffffffff835a4fd0) #0 witness_lock+0x5b8 stacktrace_save sys/sys/stacktrace.h:37 [inline] #0 witness_lock+0x5b8 sys/kern/subr_witness.c:1151 #1 ifioctl+0x5b4 sys/net/if.c:2061 #2 sys_ioctl+0x67c #3 syscall+0xbb6 mi_syscall sys/sys/syscall_mi.h:179 [inline] #3 syscall+0xbb6 sys/arch/amd64/amd64/trap.c:577 #4 Xsyscall+0x128 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 10223 14124K 14131K 166960K 13811 0 pcb 17 32K 36K 166960K 31 0 rtable 182 5K 7K 166960K 29662 0 pf 31 16K 16K 166960K 1711 0 ifaddr 35 13K 18K 166960K 3367 0 ifgroup 50 2K 2K 166960K 3402 0 sysctl 4 1K 5K 166960K 52 0 counters 64 36K 36K 166960K 1736 0 ioctlops 0 0K 2K 166960K 2368 0 iov 0 0K 34K 166960K 5352 0 mount 1 1K 1K 166960K 1 0 log 0 0K 0K 166960K 4 0 vnodes 1559 98K 98K 166960K 25246 0 UFS quota 1 32K 32K 166960K 1 0 UFS mount 5 36K 36K 166960K 5 0 shm 2 1K 13K 166960K 1138 0 VM map 2 1K 1K 166960K 2 0 sem 12 0K 0K 166960K 2234 0 dirhash 33 6K 7K 166960K 1956 0 ACPI 1690 195K 286K 166960K 12418 0 file desc 40 153K 253K 166960K 62685 0 sigio 0 0K 0K 166960K 2387 0 proc 65 91K 189K 166960K 29557 0 subproc 156 9K 18K 166960K 13130 0 NFS srvsock 1 0K 0K 166960K 1 0 NFS daemon 1 16K 16K 166960K 1 0 ip_moptions 1 0K 0K 166960K 14593 0 in_multi 70 5K 8K 166960K 11653 0 ether_multi 2 0K 0K 166960K 444 0 mrt 1 0K 0K 166960K 18 0 ISOFS mount 1 32K 32K 166960K 1 0 MSDOSFS mount 1 16K 16K 166960K 1 0 ttys 277 1235K 1235K 166960K 277 0 exec 0 0K 1K 166960K 23561 0 tdb 3 0K 0K 166960K 3 0 VM swap 8 62K 64K 166960K 10 0 UVM amap 310 108K 192K 166960K 545763 0 UVM aobj 131 6K 8K 166960K 145 0 pinsyscall 64 128K 180K 166960K 87773 0 memdesc 1 4K 4K 166960K 1 0 crypto data 1 1K 1K 166960K 1 0 ip6_options 0 0K 1K 166960K 4700 0 NDP 15 0K 2K 166960K 2504 0 temp 91 6825K 6953K 166960K 354776 0 kqueue 13 20K 37K 166960K 10408 0 SYN cache 2 16K 16K 166960K 2 0 ddb{0}> show all pools Name Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle plcache 128 24 0 0 1 0 1 1 0 8 0 rtpcb 120 9683 0 9677 69 68 1 3 0 8 0 rtentry 112 9821 0 9737 12 8 4 4 0 8 1 unpcb 144 60279 0 60262 235 234 1 11 0 8 0 syncache 336 1112 0 1112 40 40 0 1 0 8 0 tcpqe 32 521 0 521 58 58 0 1 0 8 0 tcpcb 808 41578 0 41540 367 354 13 23 0 8 0 arp 120 1644 0 1628 1 0 1 1 0 8 0 ipq 40 391 0 391 5 5 0 1 0 8 0 ipqe 40 7584 0 7584 5 5 0 1 0 8 0 inpcb 336 92805 0 92763 375 360 15 28 0 8 1 ip6q 72 19 0 19 13 13 0 1 0 8 0 ip6af 40 38 0 38 13 13 0 1 0 8 0 nd6 136 3155 0 3141 14 13 1 2 0 8 0 kcovpl 48 1010 0 998 1 0 1 1 0 8 0 rttmr 136 1 0 1 1 1 0 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 40037 0 39703 203 177 26 33 0 8 5 art_table 32 40038 0 39703 16 11 5 5 0 8 0 art_node 16 9818 0 9741 1 0 1 1 0 8 0 sysvmsgpl 40 94 0 82 1 0 1 1 0 8 0 semapl 112 2232 0 2222 1 0 1 1 0 8 0 shmpl 112 142 0 14 4 0 4 4 0 8 0 dirhash 1024 1341 0 1297 20 14 6 6 0 8 0 dino2pl 256 84906 0 80087 304 2 302 302 0 8 0 ffsino 272 84906 0 80087 324 2 322 322 0 8 0 nchpl 144 155233 0 152042 119 0 119 119 0 8 0 uvmvnodes 80 11719 0 0 240 0 240 240 0 8 0 vnodes 216 11719 0 0 652 0 652 652 0 8 0 namei 1024 667804 0 667804 77 76 1 3 0 8 1 percpumem 16 882 0 836 1 0 1 1 0 8 0 kstatmem 264 1694 0 1672 4 2 2 2 0 8 0 scxspl 216 587242 0 587242 155 154 1 8 1 8 1 plimitpl 152 20931 0 20902 2 0 2 2 0 8 0 sigapl 424 61466 0 61395 24 13 11 11 0 8 0 futexpl 64 762809 0 762805 32 31 1 1 0 8 0 knotepl 120 2463 0 0 25 0 25 25 0 8 0 kqueuepl 216 22274 0 22265 182 181 1 9 0 8 0 pipepl 320 12457 0 12418 130 123 7 14 0 8 1 fdescpl 496 61447 0 61395 26 16 10 10 0 8 0 filepl 152 456010 0 455694 274 254 20 26 0 8 2 lockfpl 104 17357 0 17354 10 9 1 2 0 8 0 lockfspl 48 4942 0 4939 1 0 1 1 0 8 0 sessionpl 144 1364 0 1344 2 0 2 2 0 8 0 pgrppl 48 4043 0 4015 1 0 1 1 0 8 0 ucredpl 104 92517 0 92502 1 0 1 1 0 8 0 zombiepl 144 61395 0 61395 1 0 1 1 0 8 1 processpl 1160 61466 0 61395 12 5 7 7 0 8 0 procpl 648 146514 0 146436 19 10 9 9 0 8 0 srpgc 96 36 0 36 18 17 1 1 0 8 1 sosppl 168 877 0 874 30 29 1 1 0 8 0 sockpl 664 164358 0 164292 558 543 15 30 0 8 0 mcl64k 65536 71 0 0 4 1 3 3 0 8 0 mcl16k 16384 13 0 0 2 0 2 2 0 8 0 mcl12k 12288 3 0 0 1 0 1 1 0 8 0 mcl9k 9216 3 0 0 1 0 1 1 0 8 0 mcl8k 8192 17 0 0 3 0 3 3 0 8 0 mcl4k 4096 5 0 0 1 0 1 1 0 8 0 mcl2k2 2112 7 0 0 1 0 1 1 0 8 0 mcl2k 2048 985 0 0 30 9 21 28 0 8 0 mtagpl 96 14 0 0 1 0 1 1 0 8 0 mbufpl 256 10873 0 0 568 0 568 568 0 8 0 bufpl 280 99965 0 88245 838 0 838 838 0 8 0 anonpl 24 7606216 0 7599041 760 684 76 109 0 185 1 amapchunkpl 152 1786494 0 1785738 544 504 40 51 0 158 0 amappl16 200 186728 0 186663 990 975 15 39 0 8 0 amappl15 192 23 0 23 13 13 0 1 0 8 0 amappl14 184 2823 0 2810 1 0 1 1 0 8 0 amappl13 176 93 0 93 52 52 0 1 0 8 0 amappl12 168 75901 0 75850 13 9 4 4 0 8 0 amappl11 160 46 0 34 1 0 1 1 0 8 0 amappl10 152 18 0 17 2 1 1 1 0 8 0 amappl9 144 147 0 146 2 1 1 1 0 8 0 amappl8 136 24 0 22 1 0 1 1 0 8 0 amappl7 128 2259 0 2245 1 0 1 1 0 8 0 amappl6 120 8453 0 8441 1 0 1 1 0 8 0 amappl5 112 3968 0 3956 1 0 1 1 0 8 0 amappl4 104 4844 0 4823 1 0 1 1 0 8 0 amappl3 96 369201 0 369058 7 2 5 5 0 8 0 amappl2 88 18337 0 18255 5 2 3 3 0 8 0 amappl1 80 373548 0 372873 50 32 18 26 0 8 0 amappl 88 531947 0 531706 11 3 8 8 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 144 0 14 3 0 3 3 0 8 0 uaddrrnd 24 61447 0 61395 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 61447 0 61395 1 0 1 1 0 8 0 vmmpekpl 168 544170 0 544096 5 0 5 5 0 8 0 vmmpepl 168 3808934 0 3806442 613 467 146 154 0 357 9 vmsppl 440 61446 0 61395 13 4 9 9 0 8 0 rwobjpl 56 1015845 0 1002785 275 82 193 193 0 8 0 pdppl 4096 122901 0 122790 2001 1884 117 161 0 8 6 pvpl 32 48867 0 0 390 1 389 389 0 265 0 pmappl 248 61446 0 61395 11 6 5 5 0 8 0 extentpl 40 56 0 38 1 0 1 1 0 8 0 phpool 112 4323 0 2921 42 0 42 42 0 8 0 ddb{0}> machine ddbcpu 0 Invalid cpu 0 ddb{0}> trace db_enter() at db_enter+0x25 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff830e2a3c) at panic+0x1e5 sys/kern/subr_prf.c:198 __assert(ffffffff8309aa14,ffffffff830e2535,13b,ffffffff8307948d) at __assert+0x29 tun_clone_destroy(ffff80000158b000) at tun_clone_destroy+0x38a sys/net/if_tun.c:315 if_clone_destroy(ffff8000371cf210) at if_clone_destroy+0x1d7 sys/net/if.c:1384 ifioctl(ffff800010fdda00,80206979,ffff8000371cf210,ffff800029fe7240) at ifioctl+0x5c5 sys_ioctl(ffff800029fe7240,ffff8000371cf3f0,ffff8000371cf340) at sys_ioctl+0x67c syscall(ffff8000371cf3f0) at syscall+0xbb6 mi_syscall sys/sys/syscall_mi.h:179 [inline] syscall(ffff8000371cf3f0) at syscall+0xbb6 sys/arch/amd64/amd64/trap.c:577 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7bf5f72104b0, count: -9 ddb{0}> machine ddbcpu 1 Stopped at x86_ipi_db+0x27: addq $0x8,%rsp x86_ipi_db(ffff800029b7bff0) at x86_ipi_db+0x27 sys/arch/amd64/amd64/db_interface.c:393 x86_ipi_handler() at x86_ipi_handler+0xd9 sys/arch/amd64/amd64/ipi.c:106 Xresume_lapic_ipi() at Xresume_lapic_ipi+0x27 __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x2c kd_curproc sys/dev/kcov.c:589 [inline] __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x2c sys/dev/kcov.c:158 __mp_lock(ffffffff835a4dc8) at __mp_lock+0x1a3 __mp_lock_spin sys/kern/kern_lock.c:113 [inline] __mp_lock(ffffffff835a4dc8) at __mp_lock+0x1a3 sys/kern/kern_lock.c:144 syscall(ffff800033c00940) at syscall+0xad6 mi_syscall sys/sys/syscall_mi.h:179 [inline] syscall(ffff800033c00940) at syscall+0xad6 sys/arch/amd64/amd64/trap.c:577 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7c25817c32f0, count: 8 ddb{1}> trace x86_ipi_db(ffff800029b7bff0) at x86_ipi_db+0x27 sys/arch/amd64/amd64/db_interface.c:393 x86_ipi_handler() at x86_ipi_handler+0xd9 sys/arch/amd64/amd64/ipi.c:106 Xresume_lapic_ipi() at Xresume_lapic_ipi+0x27 __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x2c kd_curproc sys/dev/kcov.c:589 [inline] __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x2c sys/dev/kcov.c:158 __mp_lock(ffffffff835a4dc8) at __mp_lock+0x1a3 __mp_lock_spin sys/kern/kern_lock.c:113 [inline] __mp_lock(ffffffff835a4dc8) at __mp_lock+0x1a3 sys/kern/kern_lock.c:144 syscall(ffff800033c00940) at syscall+0xad6 mi_syscall sys/sys/syscall_mi.h:179 [inline] syscall(ffff800033c00940) at syscall+0xad6 sys/arch/amd64/amd64/trap.c:577 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7c25817c32f0, count: -7