From nobody Tue May 26 19:41:19 2026 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gQ35q1XKdz6gLvk for ; Tue, 26 May 2026 19:41:19 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gQ35q0xCpz3fwS for ; Tue, 26 May 2026 19:41:19 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779824479; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1evxB7WJz/CzW9kdX0qMY/W8nq5HQHZ66au7Q8wxkds=; b=k7Py0si5YQdONeEsbERf2s/GgcqOU4dCjYBtgUmzVtZWZDLHfssKjit6q/NBsJltZab6ub Xs5L4XIqPRwoCT6wXy39i0Mhs4MYPvlFlQbLgCYKTWkqmsTqtO9sXwywTKOsXVoDQrnyjL plB/i0wEVedYtI64ZCyEOV6LaZngTQaCrJXsSnJWfweneF14hFNc7WzHA/g7VNsywiz8eR axX1Z3OBPyIEGw/qZwl6yARbJbrCtCIuMZxYBDUuydnfLBVPfvcFUTpblSqZ4OjCX5YrJJ x8O+xEFhGzn+bKVkVk3fMF7TU5RbYE0J1ZzHeDN+jLT8/C2CVqp2TUvSfhd4aw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779824479; a=rsa-sha256; cv=none; b=SC84SBB+79qw6D4X8+O7m6JDGrI4PCRBf0wIZfJ8O1ZdlKb+LSBEnCH1JU5A+t7n7R7vmj /oqTEfXiWn6rR6dTxtXnHg5/VfqFA5ypK/Zm+Xrp4yqksLIsCaw5Us9tlRZwjQkhdZ5OAN ahMyX/9O1MIt1l0sneWbW+1RwRmGHpc6a7LmWx+uyvit4lmPQRr3wZdWM94GiNU6eWIk6b Om99SxKcPetcqmPZQaPpJeb9DZVGaWySmZomYIZCAVxzv/IR55kFLsf77HlGzxWZsHb4Hy yNVz+ZVK6mpz7Uo/JJXy7EGZOyIvZqNzdzOo3l5/i+bycC+r0jVMmdu1r6q8IQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779824479; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1evxB7WJz/CzW9kdX0qMY/W8nq5HQHZ66au7Q8wxkds=; b=FAuDMmyjoG02FuNz14+fqngz8mhzMkvTUv9iV7guVbuWYfcEYZflB1+5Db0ysx19H1IzSu bsknRzSprSX141BBOrIwFj90mIsaaSd6ePn56tYBCGbhaxnzUE/P+Ba93x6BuFP0sZwB3e 89VDzsFfpvnR9Xh36KK0OeuXZNsJAMM8Y/5dka+RKXmYYVcRydKRyYf6goKNqyQaeMY9+k MY40OijMgoEwcGYcQHP3iCSXkZtNkWpt0L/3rJQu3WXqb97HrMs9j9vyFPh8m+zf1tp7/Z ejMFFDjoHQtM7rKeaaJSlukFWaC1smv+wNVlXwh3odtQgsaefVyCbToIllYjRQ== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4gQ35q0GdPzB55 for ; Tue, 26 May 2026 19:41:19 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 64QJfIvD070161 for ; Tue, 26 May 2026 19:41:18 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 64QJfIBV070159 for bugs@FreeBSD.org; Tue, 26 May 2026 19:41:18 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 295614] tun_destroy() holds ifnet_detach_sxlock while sleeping on tun_cv Date: Tue, 26 May 2026 19:41:19 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: olivier@freebsd.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D295614 --- Comment #6 from Olivier Cochard --- (In reply to Kyle Evans from comment #5) I dug into the git history to make sure I wasn't proposing something that h= ad already been litigated. The revert you may be thinking of is r186497 (Qing Li, Dec 2008), which bac= ked out r186483 (Kip Macy)'s TUN_CLOSED refinement on top of Qing Li's earlier r186391 cv_wait. The failure mode there was specific: `ifconfig tun0 create` without ever open(2)'ing the device left TUN_CLOSED never set, so a subsequ= ent destroy blocked on the cv forever for an *idle* tun. That failure mode doesn't apply to the current code. tun_busy is incremente= d in tun_busy_locked() (if_tuntap.c:363), called from tunopen() at line 1192, i.= e. only when something actually open(2)s /dev/tunN. An idle never-opened tun h= as tun_busy =3D=3D 0 and the EBUSY check in my patch doesn't fire. The four-li= ne create/configure/route/destroy recipe Qing Li worried about still works. I read your 274bf7c8ae7e (Aug 2025) commit message as endorsing exactly the direction this patch goes, "there's no good justification to permanently ha= ng a thread until the tunnel can be destroyed." The wrinkle on 16-CURRENT is that the hang takes ifnet_detach_sxlock down with it (held exclusively by if_clone_destroyif at if_clone.c:480), so any caller who runs `ifconfig tunN destroy` while a long-lived consumer (e.g. openvpn parked in select) holds = the fd open wedges every subsequent cloner destroy on the host plus jail -R via tuntap_prison_remove. Without DEADLKRES compiled in there's no userspace recovery; on a debug ker= nel DEADLKRES eventually panics the host. One observation I'd like to flag but not lean on: on the wedged host, kill = -9 on the parked ifconfig did not break the cv_wait_sig, the process stayed in state S on wchan tun_cond. One data point, no dtrace, I haven't traced why. So I'm not asserting the interruptibility is broken in general; only that in the wedge I hit it didn= 't help. Happy to try to reproduce cleanly on a debug kernel if it matters for the decision. EBUSY-at-entry sidesteps the question either way. The may_intr=3Dfalse (tun_uninit) path is left alone, so module unload still drains as before, only the if_clone_destroyif path changes behavior. --=20 You are receiving this mail because: You are the assignee for the bug.=