Article View: muc.lists.freebsd.bugs
Article #190[Bug 299737] WITNESS lock order reversal: net80211 com mutex -> ifnet_sx via rtnetlink dump_iface (RTM_NEWLINK event)
From: bugzilla-noreply
Date: Thu, 22 Oct 2026 15:07
Date: Thu, 22 Oct 2026 15:07
56 lines
4305 bytes
4305 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=299737
Bug ID: 299737
Summary: WITNESS lock order reversal: net80211 com mutex ->
ifnet_sx via rtnetlink dump_iface (RTM_NEWLINK event)
Product: Base System
Version: Unspecified
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: kern
Assignee: bugs@FreeBSD.org
Reporter: david@crap.solutions
Created attachment 276112
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=276112&action=edit
net: do not take ifnet_sx when iterating interface groups
Booting CURRENT with WITNESS produces, once per boot, when wpa_supplicant
brings wlan0 up:
lock order reversal: (sleepable after non-sleepable)
1st iwlwifi0_com_lo (sleep mutex) @ sys/net80211/ieee80211_ioctl.c:3711
2nd ifnet_sx (sx) @ sys/net/if.c:1485
#2 if_foreach_group #3 dump_iface #4 rtnl_handle_ifnet_event
#5 ieee80211_notify_ifnet_change #6 ieee80211_start_locked
#7 ieee80211_ioctl #8 ifhwioctl #9 ifioctl #10 kern_ioctl
net80211 posts an RTM_IFINFO/RTM_NEWLINK notification from
ieee80211_start_locked()/ieee80211_stop_locked() while holding its com
mutex (IEEE80211_LOCK, MTX_DEF|MTX_RECURSE). Since the rtnetlink
IFLAF_GROUP support the notification reaches dump_iface() -> dump_group()
-> if_foreach_group(), which acquires ifnet_sx with IFNET_RLOCK(), i.e.
sx_slock(). Which may sleep when ifnet_sx is write-held, so a sleepable
lock is taken under a non-sleepable mutex: it can deadlock if a thread
holding ifnet_sx waits for the com mutex, and with debug.witness.kdb=1
it drops into KDB during boot.
if_foreach_group() does not need ifnet_sx. Group membership is
mutated under IFNET_WLOCK with the CK_STAILQ macros, and
_if_delgroup_locked() only frees ifg_list/ifg_group/ifg_member after
NET_EPOCH_WAIT(), so readers can walk ifp->if_groups in the net epoch,
the same way if_foreach_lladdr() and if_foreach_llmaddr() already walk
if_addrhead/if_multiaddrs.
--
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-299737-227@https.bugs.freebsd.org/bugzilla/>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail From: bugzilla-noreply@freebsd.org Newsgroups: muc.lists.freebsd.bugs Subject: [Bug 299737] WITNESS lock order reversal: net80211 com mutex -> ifnet_sx via rtnetlink dump_iface (RTM_NEWLINK event) Date: Thu, 22 Oct 2026 15:07:07 +0000 Organization: Newsgate at muc.de e.V. Sender: owner-freebsd-bugs@FreeBSD.org Approved: news-admin@muc.de Distribution: world Message-ID: <bug-299737-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="79019"; 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=1792681629; 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=OfwHcF6nDLwDt+Qg59d8QUALeT39IfSaNKhzGcvBLU0=; b=TObmkiHuwDv8bsr9xIzD8WxHHFkuefVdtmEqDptm6FAZFs5gRMO0OscysGbaqavn02KG1Y 0WODz8HYJHJr7EqQ/be/ppmnWzAN2dEGI3/BrqSFfAcz1uDQGK75NEN4/Pih9HAzjeRdCd 41F4q3W4we2Dki21ovUR3LPMvGkJ2mXlLtLz7OJI8grcvvGQuu5mzP7rcAmUxObWLiIP8T iw4sDbtCbNKCZuYHxwJmMN3k+o1Af4tw5cB3nbYCVsOZcPHa1Tv0peIjxzNR8SqkNt5eKw I0sYk+W5+Q6hdWw8JggsQES15xUWS5y6N/WH2353ss51hno9xJMByYJoPOPpCA== 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