🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: muc.lists.freebsd.bugs
Article #430

[Bug 300717] Lock order reversal when unloading epair(4) while destroying vnet jails in FreeBSD >= 15.1

#430
From: bugzilla-noreply
Date: Thu, 12 Nov 2026 14:11
50 lines
3684 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300717

            Bug ID: 300717
           Summary: Lock order reversal when unloading epair(4) while
                    destroying vnet jails in FreeBSD >= 15.1
           Product: Base System
           Version: 15.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: crest@rlwinm.de

While running the regression tests for my under development if_pair(4) (not
epair) driver I found a deadlock that also exists in the base system. I'm
pretty sure this bug was introduced while fixing an other bug around vnet
destruction between 15.0 and 15.1.

The problem are the following code paths:
  - `vnet_destroy()` (sys/net/vnet.c:300) takes `ifnet_detach_sxlock`
exclusively first, then `vnet_sysuninit()` takes `vnet_sysinit_sxlock` shared
(sys/net/vnet.c:644)
  - `vnet_deregister_sysuninit()` (sys/net/vnet.c:602) takes
`vnet_sysinit_sxlock` exclusively then calls the kernel module's destructor for
every vnet which end up in `if_clone_detach()` (sys/net/if_clone.c:685) where
it deadlocks attempting to take `ifnet_detach_sxlock` exclusively.

Since it's a race condition it takes a few attempts to hang the system.

I've attached a reproducer using only epair(4) to rule out a bug in my own
experimental code.

Disclosure: I've used AI to extract a minimal reproducer out of my test harness
that doesn't rely on own experimental code.

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

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID: <bug-300717-227@https.bugs.freebsd.org/bugzilla/>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: bugzilla-noreply@freebsd.org
Newsgroups: muc.lists.freebsd.bugs
Subject: [Bug 300717] Lock order reversal when unloading epair(4) while
 destroying vnet jails in FreeBSD >= 15.1
Date: Thu, 12 Nov 2026 14:11:27 +0000
Organization: Newsgate at muc.de e.V.
Approved: news-admin@muc.de
Distribution: world
Message-ID: <bug-300717-227@https.bugs.freebsd.org/bugzilla/>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="27576"; mail-complaints-to="news-admin@muc.de"
X-Original-To: bugs@mlmmj.nyi.freebsd.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1794492688;
	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;
	bh=1SBDd0sLN6dfAkzvrQMUyr5gKj4fTgk1nc5J18gOsLU=;
	b=GigSsRqgko9WdusRXx4sp60qumUf7OEjbWuDyEoXqHtFoDhMqI9f6RL87JlxJw2pBFsStU
	BiLdlilb1a3EACcoLBo1M3CESt3G749qWOxGMsA7FHWZD2rFC7/AjJlc3C3qpZT+EE/c4E
	YbeE7+8xoAjvFexj8Vv4sGVBVv7oulIbB3t+LxoExkaD37UfCln4OG53b1gg9lorAOuBpp
	07+b4teu4bwnCUy9WdhDhye5k11ML9Gv/vgJqyrDxnpv851IDutjLtisKC0+PvzUhjy55+
	a/W1VDjVPexDnxKfj892yOGha+kDgsbgQuTC8uirbJy3ldzNznog73tKt2oHqw==
X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f
Auto-Submitted: auto-generated
Precedence: list
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes