[Bug 275840] ifconfig tun<n> destroy deadlock

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 19 Dec 2023 14:24:23 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275840

            Bug ID: 275840
           Summary: ifconfig tun<n> destroy deadlock
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: rscheff@freebsd.org

While understanding PR275798 and making heavy use of packetdrill (which creates
and destroys TUN interfaces) I ended up in a deadlock - initially freezing any
ifconfig tun<n> destroy, and ultimately panicing the system.

Unfortunately, too much stuff had accumulated so no proper core, only this:


tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun1: link state changed to UP
tun1: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun1: link state changed to UP
tun1: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun0: link state changed to DOWN
tun0: link state changed to UP
tun1: link state changed to UP
tun1: link state changed to DOWN
nd6_setmtu0: new link MTU on tun1 (1200) is too small for IPv6
tun2: link state changed to UP
tun2: link state changed to DOWN
panic: deadlres_td_sleep_q: possible deadlock detected for 0xfffff8000505a000
(ifconfig), blocked for 180179 ticks

cpuid = 6
time = 1702994520
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00e6b0ad20
vpanic() at vpanic+0x132/frame 0xfffffe00e6b0ae50
panic() at panic+0x43/frame 0xfffffe00e6b0aeb0
deadlkres() at deadlkres+0x32a/frame 0xfffffe00e6b0aef0
fork_exit() at fork_exit+0x82/frame 0xfffffe00e6b0af30
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe00e6b0af30
--- trap 0, rip = 0, rsp = 0, rbp = 0 ---
KDB: enter: panic
Uptime: 12h40m22s

Dump failed. Partition too small (about 1478MB were needed this time).
---<<BOOT>>---


uname -a
FreeBSD freebsd 15.0-CURRENT FreeBSD 15.0-CURRENT #1
snderr_sack-n266985-57ebadb55ba1: Sun Dec 17 17:29:27 CET 2023   

This is one local small fix in tcp_output above
a9504d76ccdad240b7d5761f4208e252f57042dd.

-- 
You are receiving this mail because:
You are the assignee for the bug.