IR_PHYSICAL_DISK OFFLINE branch uses '|= ~MPR_TARGET_FLAGS_RAID_COMPONENT' β sets every flag bit instead of clearing one (disk stays hidden; HDD not stopped at power-off)
Summary
'|=' with '~' leaves RAID_COMPONENT set (ex-RAID disk locked out of the OS) and force-sets all other bits including IS_SATA_SSD, which drives stop_at_shutdown - spinning HDDs are classified SSD and never stopped at shutdown, defeating the spin-down data protection the SSU machinery exists for. mpr twin of mps DF-1698. &= fix (compile-validated).
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-4254 Β· 10 files| File | Type | Description | Size | |
|---|---|---|---|---|
| README.md | β | 1.8 KB | β raw | |
| VERDICT.md | β | 1.9 KB | β raw | |
| build.log | β | 7.4 KB | view raw | |
| build.sh | β | 65 B | view raw | |
| env.txt | β | 588 B | view raw | |
| fix.diff | β | 335 B | view raw | |
| run.log | β | 425 B | view raw | |
| run.sh | β | 89 B | view raw | |
| trigger.sh | β | 285 B | view raw | |
| verdict.json | β | 1.8 KB | view raw |
DF-4254 β targ->flags |= ~MPR_TARGET_FLAGS_RAID_COMPONENT sets every flag bit instead of clearing one
Where
sys/dev/raid/mpr/mpr_sas_lsi.c:597-599 (MPI2_EVENT_IR_PHYSICAL_DISK,
PD-state OFFLINE / NOT_CONFIGURED / NOT_COMPATIBLE / default branch):
if (targ) {
targ->flags |= ~MPR_TARGET_FLAGS_RAID_COMPONENT; /* BUG */
Should be &= ~ (clear the RAID_COMPONENT bit). This is the mpr twin of
mps(4) DF-1698 (mps_sas_lsi.c), which was filed for the mps driver β the
same defect exists here and was not covered by any mpr finding.
What
|= with the inverted mask (0xFFFFFFFE on a flags field holding
MPR_TARGET_FLAGS_RAID_COMPONENT | MPR_TARGET_IS_SATA_SSD bits):
* the RAID_COMPONENT bit itself stays SET β the disk that just went
OFFLINE/removed from the volume remains marked as a hidden RAID
component, so mprsas_add_device (:909) keeps skipping the ID/reuse
checks for it and the OS never sees the disk (locked out),
* every other flag bit is force-set, including MPR_TARGET_IS_SATA_SSD,
which mprsas_ir_shutdown (:1677-1698) uses to decide
stop_at_shutdown β an affected HDD gets treated as SSD and is NOT
stopped on shutdown β spindle still spinning at power-off (the exact
data-corruption scenario the SSU path exists to prevent).
Trigger
mpr(4) IR-mode HBA; a phys disk state-change event with ReasonCode STATE_CHANGED and NewValue OFFLINE/NOT_CONFIGURED/NOT_COMPATIBLE while a target exists for the handle. Firmware-event-driven; hardware-gated on the audit guest.
Fix
fix.diff β one character-class change:
- targ->flags |=
- ~MPR_TARGET_FLAGS_RAID_COMPONENT;
+ targ->flags &=
+ ~MPR_TARGET_FLAGS_RAID_COMPONENT;
Build/run
build.log β compile-validated on the audit guest.
DF-4254 VERDICT
status: untested (hardware-gated: no mpr HBA on the audit guest) impact: logic/data-integrity (disk lockout + wrong shutdown handling) confidence: certain (single-token defect, mps twin already acknowledged as DF-1698)
Trace
mpr_sas_lsi.c:590-606: PD-state OFFLINE branch intends to expose a former
RAID component to the OS by clearing MPR_TARGET_FLAGS_RAID_COMPONENT, but
:598-599 uses |= with the inverted mask β all bits except
RAID_COMPONENT get set and RAID_COMPONENT remains set. Consequences:
- Disk lockout:
mprsas_add_device(:909) special-cases targets whose RAID_COMPONENT bit is set (skips ID/reuse validation), and rescan paths treat it as still-owned by the volume β the freshly-exposed phys disk never becomes usable (same user-visible effect the mps twin DF-1698 describes: "locking disk out of OS permanently"). - Wrong SSU classification: MPR_TARGET_IS_SATA_SSD is force-set;
mprsas_ir_shutdown(:1677-1698) maps SSD flag β stop_at_shutdown = FALSE for the enable-HDD profiles β spinning HDDs are not stopped at shutdown, defeating the spin-down-before-power-off protection the whole SSU machinery exists for (potential data loss on power cut).
mps twin: DF-1698 (mps_sas_lsi.c) β identical upstream FreeBSD code, same fix applied there. No mpr-side finding existed (knowns were DF-1473/1474/ 1475 only), so this is filed for the mpr driver.
Fix: &= ~ (fix.diff, compile-validated in build.log). fix_status:
not_testable (runtime needs IR-mode HBA + phys-disk state event).
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_testablenot_testable at runtime; compile-validated ('&= ~' one-token fix).
build.log: patched module builds clean.
Confirmed kernel references
Detail
Evidence (decisive lines)
VERDICT.md flag-semantics trace; build.log compile-validation.
PoC changes
n/a - pass-2 finding; trigger documentation written fresh (hardware-gated, no seed PoC existed)
Verified recommended fix
targ->flags &= ~MPR_TARGET_FLAGS_RAID_COMPONENT
Verdict
IR_PHYSICAL_DISK OFFLINE branch does targ->flags |= ~MPR_TARGET_FLAGS_RAID_COMPONENT (:598-599) instead of &= ~: RAID_COMPONENT stays set (disk locked out of OS via add_device :909 special-casing) and every other flag bit is force-set, including MPR_TARGET_IS_SATA_SSD which drives stop_at_shutdown in mprsas_ir_shutdown (:1677-1698) - affected HDDs are not stopped at power-off (data-loss vector the SSU machinery exists to prevent). mpr twin of mps DF-1698; no mpr-side finding existed.
No comments yet.