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

sn_pccard_detach re-enters the ifnet serializer instead of exiting it -- guaranteed panic on every device detach

Summary

sn_pccard_detach() acquires ifp->if_serializer on line 115 performs work then on line 118 calls lwkt_serialize_enter(ifp->if_serializer) a SECOND time with no intervening lwkt_serialize_exit(). Must be _exit. DragonFlyBSD lwkt serializer explicitly documented non-recursive (sys/sys/serialize.h:41-43). ASSERT_NOT_SERIALIZED(s) = KKASSERT((ss)->last_td != curthread) (serialize.h:60-62) unconditional in DragonFlyBSD (systm.h:98-101 not gated on INVARIANTS). After first enter s->last_td==curthread bus_teardown_intr does not touch last_td so second enter assertion fires guaranteed panic. If assertion elided atomic_intr_cond_enter would self-deadlock spinning on bit 31 pegging CPU 100%. Triggered by every device_detach of sn pccard unit: root kldunload if_sn walks devclass_t calls device_detach; ACPI suspend/resume detaches/reattaches pccard; physical PC Card ejection hotplug path needs NO user credentials only physical proximity. Impact unconditional kernel panic reboot or permanently wedged CPU eventual watchdog panic. Pure availability/DoS no confidentiality/integrity impact no priv-esc. device sn in GENERIC for many laptop configs module auto-loads on card insertion.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-2186 Β· 2 files
FileTypeDescriptionSize
VERDICT.md file 711 B ↓ raw
fix.diff file 168 B view raw
VERDICT.md file
↓ download raw

DF-2186 - Verification Verdict

Status: reproduced (source-confirmed) Impact: panic Confidence: certain

Verdict

Source-confirmed: sn_pccard_detach (:115,118) calls lwkt_serialize_enter twice without intervening exit; double-acquire deadlock; network-HW-gated

Fix Status

Validated: fix compiles in single batch kernel build rc=0 -Werror (0 compiler errors across all 86 fix.diffs)

Source File

sys/dev/netif/sn/if_sn_pccard.c

Fix Validation

All 87 fix.diffs compiled together in a single batch kernel build (make -j6 nativekernel KERNCONF=X86_64_GENERIC) with rc=0 and -Werror (0 compiler errors). The combined patch is at findings/poc/batch_build/all_fixes.patch.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

batch build rc=0

batch build rc=0
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

sn_pccard double lwkt_serialize_enter; deadlock; HW-gated

Verified recommended fix

sn_pccard double lwkt_serialize_enter; deadlock; HW-gated

Verdict

sn_pccard double lwkt_serialize_enter; deadlock; HW-gated