Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Dec 2019 20:08:45 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 242841] Unkillable process when attempting to destroy an open tun device
Message-ID:  <bug-242841-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D242841

            Bug ID: 242841
           Summary: Unkillable process when attempting to destroy an open
                    tun device
           Product: Base System
           Version: 12.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: cperciva@FreeBSD.org

This is admittedly partly a case of "don't do that" (I tripped over it due =
to a
bug in code I was writing), but it seems like the kernel should handle it a=
 bit
more gracefully.

If you:

1. Create a tun device (via SIOCIFCREATE),
2. Open the tun device (via open("/dev/tun#")), and then
3. Attempt to destroy the tun device (via SIOCIFDESTROY),

the SIOCIFDESTROY ioctl will block on tun_condvar until the last file
descriptor holding the device open has been closed.  Generally sensible...
except that the file descriptor in question is owned by the process which
called the ioctl, and it's stuck inside the kernel now and will never be ab=
le
to close the device.  This results in a process which cannot be killed.

A better solution might be to detect when the process calling SIOCIFDESTROY=
 is
the same as the process which owns the tunnel device, and return an error
(maybe EBUSY) rather than blocking indefinitely.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-242841-227>