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

ixgbe_led_{on,off}_t_X550em: PHY read return ignored β€” uninitialized stack word masked and written back to the X557 LED provisioning register

Summary

Both LED functions discard the ixgbe_read_phy_reg() return, modify the uninitialized stack u16 phy_data, and write it to the PHY. Contrast: the sibling get_supported_physical_layer ignores its read too but pre-initializes to 0. Latent: if_ix.c never dispatches the LED ops. If a future caller dispatches them, a failed MDIO read persists an uncontrolled 16-bit value into the X557 LED register - PHY misconfiguration only, no kernel memory unsafety. fix.diff compile-validated.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-3724 Β· 6 files
FileTypeDescriptionSize
README.md β€” 1.0 KB ↓ raw
VERDICT.md β€” 1.8 KB ↓ raw
fix.diff β€” 2.1 KB view raw
fix_build.log β€” 730 B view raw
manifest.json β€” 621 B view raw
verdict.json β€” 1.8 KB view raw

DF-3724 β€” ixgbe_led_{on,off}_t_X550em: PHY register read return ignored β†’ uninitialized stack word masked and written back to the PHY

File: sys/dev/netif/ix/ixgbe_x550.c:4541-4559, 4566-4584 Severity: Info (latent β€” LED ops have no caller in if_ix.c) Confidence: certain (DF-3643/3671 parity)

ixgbe_read_phy_reg() (MDIO over SWFW+token semaphore) can fail (IXGBE_ERR_PHY / SWFW_SYNC / MDIO timeout). Both LED functions ignore the return and then compute phy_data |= / &= ~MASK on the uninitialized stack u16 phy_data and write it into X557 LED_PROVISIONING. DF-3643/3671 family (failed read β†’ garbage write-back).

  • Dead in-tree: if_ix.c never calls led_on/led_off (verified: no caller of hw->mac.ops.led_* or ixgbe_led_* in the driver); op is exported shared-code surface for future/tools callers.
  • Not runtime-verifiable: guest has no X550 NIC (see ../DF-3723/env.txt).
  • fix.diff (status checks + s32 status decl) compile-validated on guest /usr/src module build with -Werror β€” see fix_build.log.
VERDICT.md
↓ download raw

DF-3724 β€” VERDICT

Status: inconclusive (no X550 hardware on guest; no in-tree caller of the LED ops). Source-certain defect pattern (DF-3643/3671 family).

  • ixgbe_x550.c:4551-4552 β€” ixgbe_read_phy_reg(hw, ..., &phy_data) return value discarded; phy_data is an uninitialized stack u16 (declared :4543).
  • ixgbe_x550.c:4553-4555 β€” phy_data |= IXGBE_X557_LED_MANUAL_SET_MASK; then ixgbe_write_phy_reg(...) persists the uninitialized-derived value into the X557 LED provisioning register.
  • Mirror at :4576-4580 (led_off).
  • Contrast with the sibling ixgbe_get_supported_physical_layer_X550em (:3652-3654) which also ignores the read but initializes ext_ability = 0 (:3621) β€” the LED functions do not.

Why Info

No in-tree caller: rg 'led' if_ix.c β†’ no LED op dispatch anywhere in the driver (the ops are wired in ixgbe_init_ops_X550:95-99 but only ever invoked through ixgbe_api.c wrappers that if_ix never calls). Reachable only by future code or ported tools; impact when reached is a PHY misconfiguration (uncontrolled 16-bit value OR/AND-ed into an LED register), not kernel memory corruption.

Verification

  • Guest pciconf -lv (../DF-3723/env.txt): no X550 β†’ HAL cannot execute.
  • fix.diff compile-validated on guest /usr/src (module build, -Werror, make_rc=0, see fix_build.log), reverted afterwards (md5 restored).

Check both PHY access returns and bail on failure β€” see fix.diff.

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

inconclusive
baseline no→ patch + rebuild →patched clean

fix.diff (adds s32 status + early returns) applied to guest /usr/src; if_ix.ko module rebuild clean under -Werror (fix_build.log, DF-3724_make_rc=0); reverted after. Runtime validation impossible (no hardware).

fix_build.log: DF-3724_make_rc=0 with linking line; md5 restored to baseline
↓ fix.diffper-fix-DF-3724

Confirmed kernel references

Detail

Evidence (decisive lines)

VERDICT.md (path:line trace); fix_build.log (fix.diff compiles clean, -Werror, make_rc=0); ../DF-3723/env.txt (no X550 on guest)

PoC changes

n/a (source-level)

Verified recommended fix

Check the ixgbe_read_phy_reg/ixgbe_write_phy_reg returns in both LED functions and return on failure (fix.diff)

Verdict

ixgbe_led_on_t_X550em/ixgbe_led_off_t_X550em discard the ixgbe_read_phy_reg() return and write back a masked uninitialized stack u16 into the X557 LED provisioning register (ixgbe_x550.c:4551-4555, 4576-4580) β€” DF-3643/3671 family. Runtime inconclusive: guest has no X550 NIC and if_ix.c never dispatches the LED ops (latent). Contrast: ixgbe_get_supported_physical_layer_X550em:3652 ignores its read too but pre-initializes ext_ability=0.