Dead switch-error check in mmc_switch_status compares a status field to a raw bit value
Summary
mmc_switch_status at mmc_subr.c:211 does R1_CURRENT_STATE(status) == R1_SWITCH_ERROR. R1_CURRENT_STATE(x) extracts 4-bit field (values 0-15) via mmcreg.h:145; R1_SWITCH_ERROR is a raw status bit (1u<<7=128). A 4-bit field (max 15) can NEVER equal 128, so predicate is provably always false. Switch errors from malicious/emulated MMC card silently ignored, mmc_switch returns MMC_ERR_NONE. Only consumer of R1_SWITCH_ERROR in entire sys/ tree. Intended check is bit test: (status & R1_SWITCH_ERROR) != 0. Impact: host proceeds with bus-width/speed/partition config the card rejected -> data corruption / DoS. Requires malicious/emulated MMC card; no userspace-only trigger.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1115 Β· 3 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | Source-confirmation verdict for DF-1115 | 627 B | β raw |
| fix.diff | suggested-fix | Fix dead == comparison to bitwise AND for R1_SWITCH_ERROR | 346 B | view raw |
| ../fix_build.log | build-log | Batch kernel build log (all fixes, rc=0) | 5.6 MB | β download |
DF-1115 Verification Verdict
Severity: Low Impact class: logic Verification method: Source-only confirmation (HW-gated, not triggerable on QEMU guest)
Verdict: REPRODUCED (source-confirmed)
The bug is confirmed in the audited source at the cited path:line. Triggerable but requires specific driver/config.
Fix: Fix dead == comparison to bitwise AND for R1_SWITCH_ERROR
Fix applied and validated in batch kernel build (rc=0, -Werror).
Fix validation
All 41-fix patches batched into single make -j6 nativekernel KERNCONF=X86_64_GENERIC build.
Build result: rc=0, 0 errors (full -Werror clean).
Fix verification
fixedVALIDATED: fix.diff applies cleanly + batch kernel build rc=0 -Werror; bug HW/module/runtime-gated, no runtime PoC re-test possible on guest.
VALIDATED: fix.diff applies cleanly + batch kernel build rc=0 -Werror; bug HW/module/runtime-gated, no runtime PoC re-test possible on guest.
Confirmed kernel references
β
Detail
Exploit chain
none
Evidence (decisive lines)
REPRODUCED (source-only): mmc_switch_status compares R1_CURRENT_STATE(status) (4-bit field, 0-15) == R1_SWITCH_ERROR (raw bit 1<<7=128); comparison is always false, switch-error detection is dead.
Verified recommended fix
REPRODUCED (source-only): mmc_switch_status compares R1_CURRENT_STATE(status) (4-bit field, 0-15) == R1_SWITCH_ERROR (raw bit 1<<7=128); comparison is always false, switch-error detection is dead.
Verdict
REPRODUCED (source-only): mmc_switch_status compares R1_CURRENT_STATE(status) (4-bit field, 0-15) == R1_SWITCH_ERROR (raw bit 1<<7=128); comparison is always false, switch-error detection is dead.
No comments yet.