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

siba_cc_power_init (reached unconditionally from siba_core_resume -> siba_cc_resume) dereferences scc->scc_dev with no NULL check - panic on resume when scan found no ChipCommon core

Summary

Every sibling function guards scc_dev == NULL but siba_cc_power_init dereferences it in its initializer, and the suspend/resume path calls it without the guard - a card whose core scan failed (device-controlled NCORES garbage, switchcore failure, no CHIPCOMMON core) panics the kernel on the first suspend/resume cycle. SSB card reporting garbage core topology still attaches as a siba bus device; any S3/lid suspend-resume then NULL-derefs. SPROM constant sweep verified NEGATIVE this pass: every non-TXPID offset in-bounds against both 64- and 220-word buffers (r123 max 58<64; r45 max 151<220; r8 max 202<220). Guard fix.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-3926 Β· 6 files
FileTypeDescriptionSize
README.md β€” 2.5 KB ↓ raw
VERDICT.md β€” 1.7 KB ↓ raw
fix.diff β€” 790 B view raw
env.txt β€” 1.2 KB view raw
manifest.json β€” 911 B view raw
verdict.json β€” 2.0 KB view raw

DF-3926 β€” siba_cc_power_init NULL-deref panic on the suspend/resume path when no ChipCommon core was found

What

sys/dev/netif/bwn/siba/siba_core.c:

static void
siba_cc_power_init(struct siba_cc *scc)
{
    struct siba_softc *siba = scc->scc_dev->sd_bus;   /* :1042 β€” NO NULL check */

(its sibling siba_cc_powerup_delay has the same unguarded deref at :1071.)

Every other consumer of scc->scc_dev guards it (siba_cc_clock :786-787, siba_cc_pmu_init caller gate :210, siba_powerdown_sub :1900). The attach path is safe because siba_core_attach only calls these under if (scc->scc_dev != NULL) (siba_core.c:210-215).

The resume path is not:

siba_core_resume (siba_core.c:2236-2249)
  -> siba_cc_resume(&siba->siba_cc)        /* :2245 β€” unconditional */
     -> siba_cc_power_init(scc)            /* :2223 */
        -> scc->scc_dev->sd_bus            /* :1042 PANIC if scc_dev == NULL */

How scc_dev ends up NULL on a live device

siba_scan (siba_core.c:284-414) sets siba_cc.scc_dev only when some core reports SIBA_DEVID_CHIPCOMMON (:351-360). It stays NULL when: - the very first siba_switchcore(siba, 0) fails β†’ early return (:296-298); - hardware reports siba_ndevs > SIBA_MAX_CORES β†’ early return after the warning (:325-330) β€” siba_ndevs comes straight from the MMIO ChipCommon SIBA_CC_NCORES(tmp) field (:307), i.e. device-controlled; - core windows return garbage IDHIGH so no core matches CHIPCOMMON.

In all these states the bwn child is never created, but the siba PCI bus device is attached (probe matched the DID table, siba_bwn.c:91-137), so siba_bwn_suspend β†’ siba_bwn_resume (siba_bwn.c:211-249) still run on the next suspend/resume cycle (ACPI S3, laptop lid) β†’ deterministic NULL-deref panic at a small fixed offset (sd_bus is at offset 0 of siba_dev_softc, so the fault address is ~0).

Sibling of DF-1939 (NULL-deref in siba_bwn_read_ivar) but a distinct function/path (resume vs ivar read).

Impact

Kernel panic (NULL deref) from a suspend/resume cycle on a card whose scan failed β€” device-controlled preconditions (bad MMIO/NCORES), hardware-gated. Severity Low, confidence certain at source level.

Reproduce (needs a Broadcom SSB card + forced scan failure / S3 cycle)

Not possible on the audit guest: no 14e4 PCI device (env.txt).

Fix

 (move the deref below the guard:)
+   if (scc->scc_dev == NULL)
+       return;
+   siba = scc->scc_dev->sd_bus;

(also guard siba_cc_powerup_delay; see fix.diff)

VERDICT.md
↓ download raw

DF-3926 VERDICT

status: not_reproduced (hardware-gated) | impact observed: none (potential: NULL-deref panic) | source certainty: certain

Trace

  1. siba_bwn.c:140-174 β€” siba_bwn_attach maps BAR0 and calls siba_core_attach for any card matching the DID table (probe :121-137). Child bwn devices exist only if siba_scan found an 802.11 core; the siba bus device itself exists regardless.
  2. siba_core.c:351-360 β€” scc_dev assigned only on a CHIPCOMMON core; NULL otherwise, including the early-return states at :296-298 (switchcore failure) and :325-330 (ndevs > SIBA_MAX_CORES, value read from device-controlled SIBA_CC_NCORES at :307).
  3. siba_core.c:210-215 β€” attach-path callers are NULL-guarded.
  4. siba_core.c:2236-2249 β€” siba_core_resume calls siba_cc_resume UNCONDITIONALLY; :2219-2225 siba_cc_resume calls siba_cc_power_init; :1040-1042 dereferences scc->scc_dev->sd_bus without a check β†’ NULL deref. (siba_cc_clock in the same path is guarded :786-787 β€” the asymmetry is the bug.)
  5. Trigger: any suspend/resume cycle with such a card (ACPI S3).

Why not reproduced

The audit guest has no Broadcom SSB card (env.txt: no 14e4 PCI device, no bwn/siba modules). The dereference is unconditional in code once the precondition holds; the only uncertainty is hardware, not logic.

Fix validation

Hardware-gated; fix.diff adds the same NULL guard the sibling functions use.

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

not_testable
baseline no→ patch + rebuild →patched clean

fix.diff adds the standard NULL guard; cannot validate without SSB hardware

fix.diff in this pack; never applied to sys/
↓ fix.diffper-fix-DF-3926

Confirmed kernel references

Detail

Exploit chain

SSB card + failed/garbage core scan (device-controlled) -> bwn child never created but siba bus device attached -> ACPI S3 suspend/resume -> siba_core_resume -> siba_cc_power_init NULL-deref panic

Evidence (decisive lines)

VERDICT.md asymmetric-guard trace (:1042 unguarded vs :786/:210/:1900 guarded)

PoC changes

n/a (fresh pack)

Verified recommended fix

Add the scc_dev NULL guard to siba_cc_power_init (and siba_cc_powerup_delay for symmetry)

Verdict

siba_cc_power_init dereferences scc->scc_dev->sd_bus with no NULL guard (siba_core.c:1042) while every sibling (siba_cc_clock :786, attach-path callers :210-215, siba_powerdown_sub :1900) guards it. siba_core_resume calls siba_cc_resume unconditionally (:2245 -> :2223), so a suspend/resume cycle on a card whose siba_scan found no ChipCommon core (early returns at :296/:325 β€” the latter keyed on the device-controlled SIBA_CC_NCORES value) panics with a NULL deref. Certain at source; not reproduced because the guest has no Broadcom SSB hardware.