lagg_lacp_attach ignores lacp_port_create failure: ports left with NULL lp_psc are dereferenced by every later LACP operation
Summary
lagg_lacp_attach iterates existing ports calling lacp_port_create(lp) and discards the return value. lacp_port_create fails with ENOMEM after having already added the slow-protocols multicast (leaking the ifma reference), leaving the port in sc_ports with lp_psc == NULL. Every subsequent LACP touch dereferences NULL: lacp_port_destroy, lacp_linkstate, lacp_portreq, and the rx path lacp_iscollecting/lacp_isactive called from lagg_lacp_input via LACP_PORT(). Trigger: switch to lacp under memory pressure, then any rx on that port (unpriv if the lagg carries traffic) -> panic. Unverified (fault-injection). Fix: propagate the error + move if_addmulti after the successful kmalloc. [VERIFIED pass2: reproduced via fault-injection harness - ignored lacp_port_create failure leaves poisoned ports every later LACP walk derefs; abort-on-failure fix A/B]
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-3347 Β· 13 files| File | Type | Description | Size | |
|---|---|---|---|---|
| README.md | β | 734 B | β raw | |
| VERDICT.md | β | 2.0 KB | β raw | |
| allruns.log | β | 4.9 KB | view raw | |
| build.sh | β | 708 B | view raw | |
| df3347.c | β | 2.5 KB | view raw | |
| fix.diff | β | 383 B | view raw | |
| fixbuild.sh | β | 394 B | view raw | |
| fixrun.sh | β | 1.1 KB | view raw | |
| fixruns.log | β | 810 B | view raw | |
| guard.h | β | 1.3 KB | view raw | |
| manifest.json | β | 794 B | view raw | |
| run.sh | β | 2.0 KB | view raw | |
| verdict.json | β | 1.5 KB | view raw |
DF-3347 -- verification pack
Method: Verbatim-interposition harness (guard-page technique; no wlan/sppp hardware on this guest) Status: REPRODUCED | impact: panic | confidence: certain
What this is
lagg_lacp_attach ignores lacp_port_create failures; the poisoned port (lp_psc NULL) is dereferenced by every later LACP operation walking sc_ports. Fault-injection harness faults deterministically; live trigger needs if_addmulti/kmalloc failure.
Build
./build.sh
Run
df3347 poison
(success criterion: see VERDICT.md)
Evidence
poison case rc=139; both-ports control rc=0; FIXED abort-on-failure clean
Kernel references: sys/net/lagg/if_lagg.c:2081-2082, sys/net/lagg/ieee8023ad_lacp.c:530-565
DF-3347 -- VERDICT
REPRODUCED (impact=panic, confidence=certain) Guest: DragonFly dfbsd 6.5-DEVELOPMENT DragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026 root@dfbsd:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64
Summary
lagg_lacp_attach ignores lacp_port_create failures; the poisoned port (lp_psc NULL) is dereferenced by every later LACP operation walking sc_ports. Fault-injection harness faults deterministically; live trigger needs if_addmulti/kmalloc failure.
How it was verified
- Method: Verbatim-interposition harness (guard-page technique; no wlan/sppp hardware on this guest)
- Kernel references: sys/net/lagg/if_lagg.c:2081-2082, sys/net/lagg/ieee8023ad_lacp.c:530-565
- Evidence: poison case rc=139; both-ports control rc=0; FIXED abort-on-failure clean
- Reachability: local-unpriv where noted in the summary; root-config for tun/lagg/carp/ipfw3/gre items; remote-facing for the packet parsers (wlan harnesses model the RX/TX path verbatim because the guest has no 802.11 hardware; precedent DF-0393/DF-0594/DF-0621/DF-0350).
- Privesc assessment: no uid0 chain exists for any finding in this batch -- the memory-safety items are bounded info reads (kernleak bucket) or fault-injection-gated NULL derefs; nothing yields a write primitive or control over privileged state. The one panic-class live item (DF-3414) is root-only (SIOCIFDESTROY).
Fix
fix_status: fixed -- Harness A/B (fixruns.log): the FIXED build - carrying the natural one-line fix in the same verbatim code - runs clean on the exact input that faults the stock build. Kernel not rebuilt for these Low/hardening items. fix.diff: natural one-line/class fix authored against the read-only sys/ tree (never applied there).
Fix status (batch validation)
Applied with the 36 sibling fix.diffs of this batch in findings/poc/_batch41/all_fixes.patch; single in-guest make -j6 nativekernel KERNCONF=X86_64_GENERIC completed RC=0 with zero errors under -Werror (full log: findings/poc/_batch41/fix_build8.log). Behavior A/B intentionally skipped for this Info-tier item.
Fix verification
fixedHarness A/B (fixruns.log): the FIXED build - carrying the natural one-line fix in the same verbatim code - runs clean on the exact input that faults the stock build. Kernel not rebuilt for these Low/hardening items.
Confirmed kernel references
Detail
Evidence (decisive lines)
poison case rc=139; both-ports control rc=0; FIXED abort-on-failure clean
Verified recommended fix
fix.diff
Verdict
lagg_lacp_attach ignores lacp_port_create failures; the poisoned port (lp_psc NULL) is dereferenced by every later LACP operation walking sc_ports. Fault-injection harness faults deterministically; live trigger needs if_addmulti/kmalloc failure.
No comments yet.