🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

[Bug 300670] ix(4): setting dev.ix.N.eee_state hangs forever and corrupts the ifnet's if_broadcastaddr

#407
From: bugzilla-noreply
Date: Tue, 10 Nov 2026 23:00
101 lines
6184 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300670

            Bug ID: 300670
           Summary: ix(4): setting dev.ix.N.eee_state hangs forever and
                    corrupts the ifnet's if_broadcastaddr
           Product: Base System
           Version: CURRENT
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: bugs@pletch.org

Created attachment 277173
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=277173&action=edit
Proposed patch.

Setting the EEE sysctl on a running ix(4) interface never returns:

        # sysctl dev.ix.1.eee_state=0
        (hangs; the process is in D state and cannot be killed)

        # procstat -kk <pid>
        mi_switch+0xbc _sx_xlock_hard+0x496 iflib_if_init+0x7f
        ixgbe_sysctl_eee_state+0x116 sysctl_root_handler_locked+0x91
        sysctl_root+0x268 userland_sysctl+0x1a6 sys___sysctl+0x65
        amd64_syscall+0x126 fast_syscall_common+0xf8

Cause: ixgbe_sysctl_eee_state() restarts the interface with

        if_init(ifp, ifp);

but under iflib the init handler is iflib_if_init(void *arg), which
expects the if_ctx (the ifnet's softc), not the ifnet. CTX_LOCK() then
calls sx_xlock() on whatever lies at the offset of ifc_ctx_sx inside
struct ifnet.

On 15.1/amd64 the word read as the lock state is if_broadcastaddr
(&etherbroadcastaddr). It looks like an exclusive owner, so the thread
sleeps there forever. Nothing else holds the real context lock: other
threads take it normally (ifconfig, which takes it in
iflib_media_status(), keeps working). The waiter bit (0x4) that
_sx_xlock_hard() sets is written into if_broadcastaddr, which then
points at etherbroadcastaddr+4, so broadcasts sent on that ifnet go to
ff:ff:00:00:00:00. Read from kernel memory with dtrace on the affected
box:

        if_broadcastaddr = kernel`etherbroadcastaddr+0x4
        bytes there: ff:ff:00:00:00:00

ixgbe_setup_eee() has already run by then (the link renegotiates), but
the new state is never cached in feat_en, so eee_state keeps reading
the old value.

Impact: this sysctl is the only way to turn EEE off on these
adapters. ixgbe_init_device_features() enables EEE by default on every
E610 whose firmware reports EEE support, and the driver has no loader
tunable for it. A sysctl.conf entry (or an appliance "tunable" applied
at boot) hits the same hang at every boot. The only other way to
disable EEE is at the link partner, which is not always possible.

ixgbe_sysctl_dmac() had the same if_init(ifp, ifp) call until
f5dc44c045c6 ("ixgbe: Apply DMAC changes through an if-up reset
request"). The attached patch applies the EEE change the same way:
under the context lock, followed by iflib_request_reset_if_up() and
iflib_admin_intr_deferred().

Hardware: Intel E610-XT2 (8086:57b0), NVM 1.70, passed through to a
KVM guest. Seen on both ports (ix0 and ix1), each time.
Not E610-specific: ixgbe_init_device_features() also sets
IXGBE_FEATURE_EEE for X550EM_x KR (0x15AB) and X550EM_a 1G_T/1G_T_L
(0x15E4/0x15E5), so the same handler, and the same hang, is reached on
those (Xeon D-1500 and Atom C3000 integrated ports). Found by reading
the code; not tested on that hardware.
Software: OPNsense 26.7 (FreeBSD 15.1-RELEASE-p6, stable/26.7
c962f76493b6). The call is unchanged in main (d0fd70983b6b,
2026-11-09), and the patch applies there cleanly.

The patch is against main and passes checkstyle9.pl.

Tested: the same change, applied to OPNsense's stable/26.7 tree
(c962f76493b6, with f5dc44c045c6 and 4a0ec469934a/ac24108dabca also
applied), built and run on the affected E610-XT2. With the patched
kernel, "sysctl dev.ix.0.eee_state=0" and "sysctl dev.ix.1.eee_state=0"
return at once, the link renegotiates (about 5 s), eee_state then reads
0, and no thread is left waiting.
Not built against main itself; the function is identical there apart
from line numbers.

-- 
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-300670-227@https.bugs.freebsd.org/bugzilla/>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!usenet.goja.nl.eu.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!news.tcpreset.net!newsfeed.bofh.team!usenet.goja.nl.eu.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 300670] ix(4): setting dev.ix.N.eee_state hangs forever and
 corrupts the ifnet's if_broadcastaddr
Date: Tue, 10 Nov 2026 23:00:37 +0000
Organization: Newsgate at muc.de e.V.
Approved: news-admin@muc.de
Distribution: world
Message-ID: <bug-300670-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="23886"; 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=1794351637;
	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=OCIRy1f4znserymPYgItap0IJQKH9w2V6gQiSXjLQsY=;
	b=u1CAWD8Ng8oODJOzWl6AXkWouWNaTDMlt6pgfQt5F/qwohk/fvrGNGYWz/7yR67eAwL+0z
	5b8MJPZgR1BSMfAA6F6bAe+WgERa4swtpAB8yf5PARxLgyc2QmJW+GbQBmZYV9DUYvQeod
	K1weTAuKVrFhHG8jwU88M+LdQg6OA5GLK3ChU0/+DUPoay8yEBLu9gaEOdNsjlm1M6lu1b
	3EoSf5PgUgTDNEO7ouy6Ufsu1uDkUVOt3GBwWk6BBkswrakQ+epAGOScwSjifUJVb5F8w3
	898RjqUDIBFWAwhORlcfs6dCRaUfKP80NHVIuidQ34HJOww6H/E/yzZ7gU8qHQ==
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