bootutil: scramble the first block going backwards on devices without erase #3024
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 275 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.336
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3024"
general
weight: 0.35
nordicjm
On devices without erase,
boot_scramble_region()going backwards never wrote the first write block of the range, because the loop condition was tested before the write.swap_scramble_trailer_sectors()scrambles the trailer this way from its start, where status entry 0 lives, so the entry left by the previous swap survived the scramble at the start of a new swap-move or swap-offset upgrade. A reset before the new swap wrote its own first status entry made the resumed swap skip that step, leaving a stale sector in the revert copy.Fixes #3021
Changes
no-erasefeature. It builds MCUboot with onlyMCUBOOT_SUPPORT_DEV_WITHOUT_ERASEand makes the simulated flash accept writes over any value. Until now the simulator only modelled NOR flash, so the no-erase code paths were never exercised.upgrade_over_stale_status, a slow test that completes and confirms one upgrade, stages another, and interrupts it at every flash operation. Without the fix it fails for both swap-move and swap-offset in the no-erase mode. It passes on devices with erase.Notes for review
multiimage,perm_with_random_failsfails for all three swap modes. It needs two interruptions, the second a few operations into the resumed boot, and happens with or without this fix. Multiimage is kept out of the new CI rows until that is looked at separately.