β¬’ DragonFlyBSD Kernel Audit
← triage Β· dashboard
DF-3346

SIOCSLAGG sets sc_proto before ti_attach: a failed protocol attach leaves sc_proto set with NULL/dead callbacks, next SIOCSLAGG calls a NULL sc_detach

Summary

sc_proto is assigned BEFORE lagg_protos[i].ti_attach(sc) runs. lagg_lb_attach's kmalloc(M_NOWAIT) can fail before installing any callback, and lacp_attach can fail on ENOMEM after lagg_lacp_attach already installed callbacks. On a failed lb attach, sc_proto stays LOADBALANCE with sc_detach == NULL: the next SIOCSLAGG executes error = sc->sc_detach(sc) - an indirect call through a NULL pointer -> guaranteed panic. On a failed lacp attach, callbacks are installed but sc_psc freed/never allocated -> next SIOCSLAGG runs lacp_port_destroy over ports whose lp_psc is NULL. Root-triggered NULL-pointer-call panic under memory pressure during laggproto reconfiguration; DoS only. Unverified (needs fault-injected ENOMEM). Fix: assign sc_proto only after attach succeeds (or roll back), defensive NULL-local detach call. [VERIFIED pass2: reproduced via fault-injection harness - failing lacp_attach poisons the next SIOCSLAGG into NULL lp_psc deref; publish-after-attach rollback fix A/B]

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-3346 Β· 13 files
FileTypeDescriptionSize
README.md β€” 818 B ↓ raw
VERDICT.md β€” 2.1 KB ↓ raw
allruns.log β€” 4.9 KB view raw
build.sh β€” 708 B view raw
df3346.c β€” 4.1 KB view raw
fix.diff β€” 371 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 β€” 820 B view raw
run.sh β€” 2.0 KB view raw
verdict.json β€” 1.5 KB view raw

DF-3346 -- 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

SIOCSLAGG publishes sc_proto before ti_attach; a failed attach (lacp_attach kmalloc M_NOWAIT failure) leaves sc_proto=LACP with NULL sc_psc, and the NEXT SIOCSLAGG NULL-derefs in lacp_port_destroy. Live trigger needs memory pressure; fault-injection harness (verbatim ordering) faults deterministically.

Build

./build.sh

Run

df3346 poison

(success criterion: see VERDICT.md)

Evidence

poison case rc=139 (NULL deref); balanced control rc=0; FIXED publish-after-attach + rollback clean

Kernel references: sys/net/lagg/if_lagg.c:1086-1117, sys/net/lagg/ieee8023ad_lacp.c:795-804

VERDICT.md
↓ download raw

DF-3346 -- 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

SIOCSLAGG publishes sc_proto before ti_attach; a failed attach (lacp_attach kmalloc M_NOWAIT failure) leaves sc_proto=LACP with NULL sc_psc, and the NEXT SIOCSLAGG NULL-derefs in lacp_port_destroy. Live trigger needs memory pressure; fault-injection harness (verbatim ordering) faults deterministically.

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:1086-1117, sys/net/lagg/ieee8023ad_lacp.c:795-804
  • Evidence: poison case rc=139 (NULL deref); balanced control rc=0; FIXED publish-after-attach + rollback 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

fixed
baseline reproduced→ patch + rebuild →patched clean

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.diffper-fix-DF-3346

Confirmed kernel references

Detail

Evidence (decisive lines)

poison case rc=139 (NULL deref); balanced control rc=0; FIXED publish-after-attach + rollback clean

Verified recommended fix

fix.diff

Verdict

SIOCSLAGG publishes sc_proto before ti_attach; a failed attach (lacp_attach kmalloc M_NOWAIT failure) leaves sc_proto=LACP with NULL sc_psc, and the NEXT SIOCSLAGG NULL-derefs in lacp_port_destroy. Live trigger needs memory pressure; fault-injection harness (verbatim ordering) faults deterministically.