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

sil164_detect uses uninitialized reg9 when sil164_readb fails (unchecked return)

Field Value
ID DF-2097
Status new
Severity Info
CVSS 3.1 CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:N
CWE CWE-457 Use of Uninitialized Variable
File sys/dev/drm/i915/dvo_sil164.c
Lines 176-180
Area drm/i915
Confidence likely
Discovered 2026-07-25
Reported pending
Known CVE none
CVE match variant

Summary

sil164_detect() declares u8 reg9; uninitialized, calls sil164_readb(dvo, SIL164_REG9, &reg9) without checking the boolean return, then tests (reg9 & SIL164_9_HTPLG). On any I2C transfer failure the function reads an uninitialized stack byte and returns a connector status derived from it. This is an inconsistency with sil164_dpms (dvo_sil164.c:216-218) and sil164_get_hw_state (dvo_sil164.c:234-236), both of which correctly check the return value and bail out. No memory-corruption or privilege impact; at most a misreported connector status (and, in theory, a 1-bit stale-stack signal) gated on an I2C hardware fault.

Root cause

  • dvo_sil164.c:176 declares u8 reg9; with no initializer.
  • dvo_sil164.c:178 calls sil164_readb(dvo, SIL164_REG9, &reg9); and discards the return value. sil164_readb (dvo_sil164.c:68-103) only writes *ch on the success path (line 94); on failure (i2c_transfer != 2) it returns false and leaves *ch untouched.
  • dvo_sil164.c:180 then evaluates reg9 & SIL164_9_HTPLG on the uninitialized byte.

Contrast with the correct pattern at dvo_sil164.c:216-218 (ret = sil164_readb(...); if (ret == false) return;) and dvo_sil164.c:234-236.

Threat model & preconditions

  • Attacker position: unprivileged local user holding /dev/drm access.
  • Privileges gained or impact: none β€” at most a misreported connector status. No memory corruption, no privilege change, no meaningful info disclosure (1 noisy bit of a recent call frame, not secrets/key material).
  • Required config or capabilities: an I2C transfer to the Sil164 chip that fails (hardware fault, disconnected/transiently-unresponsive chip, or an attacker who can influence the I2C bus β€” which needs physical access or root).
  • Reachability: DRM connector-probe ioctl path: intel_dvo_detect (intel_dvo.c:298-305) β†’ dev_ops->detect β†’ sil164_detect, invoked through drm_helper_probe_single_connector_modes (intel_dvo.c:348).

Proof of concept

Not a memory-corruption primitive; no exploit chain is possible. To demonstrate the defect (logic only):

  1. Build the standard i915-equipped DragonFlyBSD kernel.
  2. Arrange for the DVO I2C read to fail (e.g. on hardware where the Sil164 is absent/broken, or by instrumenting i2c_transfer to return <2 once).
  3. Issue DRM_IOCTL_MODE_GETCONNECTOR / force a connector probe from an unprivileged process via libdrm: drmModeGetConnector(...).
  4. Observe that the returned connector status flips between connected/disconnected nondeterministically based on stack residue rather than on the HTPLG bit β€” proving the uninitialized read.

This is a logic/robustness demonstration only; there is no path to code execution, privilege escalation, or kernel memory disclosure.

Impact

Pure correctness/robustness defect with negligible security consequence.

Check the sil164_readb return value and propagate failure as connector_status_unknown, matching the bail-out pattern already used in sil164_dpms and sil164_get_hw_state.

--- a/sys/dev/drm/i915/dvo_sil164.c
+++ b/sys/dev/drm/i915/dvo_sil164.c
@@ -174,7 +174,9 @@ static enum drm_connector_status sil164_detect(struct intel_dvo_device *dvo)
 {
    u8 reg9;

-   sil164_readb(dvo, SIL164_REG9, &reg9);
+   if (!sil164_readb(dvo, SIL164_REG9, &reg9))
+       return connector_status_unknown;

    if (reg9 & SIL164_9_HTPLG)
        return connector_status_connected;

References

Timeline

  • 2026-07-25 Discovered during automated audit.
  • 2026-07-25 Reported to DragonFlyBSD security contact.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-2097 Β· 2 files
FileTypeDescriptionSize
fix.diff suggested-fix git-apply-able fix 303 B view raw
VERDICT.md verdict source-trace confirmation 567 B ↓ raw
VERDICT.md verdict source-trace confirmation
↓ download raw

DF-2097 β€” sil164_detect uses uninitialized reg9 on readb failure

Verdict

REPRODUCED (source-only confirmation). Bug confirmed by source tracing.

Mechanism

sil164_detect (dvo_sil164.c:176-180): u8 reg9 uninitialized. sil164_readb() return value unchecked. If readb fails (returns false), reg9 remains uninitialized, then (reg9 & SIL164_9_HTPLG) reads garbage.

Fix

Check sil164_readb return value; return connector_status_unknown on failure.

Batch-build status

Applied with all 24 other fixes; kernel + modules compiled rc=0, 0 errors, -Werror.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

Check readb return; batch build rc=0.

Check readb return; batch build rc=0.
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

sil164_detect u8 reg9 uninitialized; readb return unchecked.

Verified recommended fix

sil164_detect u8 reg9 uninitialized; readb return unchecked.

Verdict

sil164_detect u8 reg9 uninitialized; readb return unchecked.