fix(core): remove backup RAM forced soc reset in power manager at battery critical state.
What changed, and why it matters
This commit removes a safety override in the Trezor hardware wallet's power manager. Previously, when the battery was at a critically low level, the device forced the reported battery percentage (state of charge, or 'soc') to 0 before saving it to backup memory. Now it saves the actual fuel gauge reading instead. This is likely a bug fix for incorrect battery reporting, but the security implications are unclear from the diff alone.
Treat as a low-confidence, low-severity change unless additional context shows the forced SOC=0 was a security boundary. Review whether removing this override could allow a device with a critically low battery to boot or operate in an unsafe state, or whether the override itself was masking a bug in fuel-gauge reporting. No immediate action required beyond normal code review and regression testing of battery-critical behavior.
Security signals we found
Change to power-management state persistence in backup RAM
Removal of battery-critical safety override
Potential for altered device behavior after critical battery shutdown
No explicit security context provided in commit message
Evidence from the diff
In core/embed/sys/power_manager/stm32u5/power_manager.c, the pm_store_data_to_backup_ram() function no longer forces recovery.soc to 0 when drv->battery_critical is true. Instead, it always stores drv->fuel_gauge.soc. The previous behavior could cause the device to wake up from backup RAM with a state-of-charge value of 0 even if the actual battery had some charge, potentially affecting power-management decisions after a critical-battery event. The patch is small and removes a conditional override; it does not by itself introduce obvious exploitable code.
Changed components
core/embed/sys/power_manager/stm32u5/power_manager.cBattery state-of-charge (SOC) backup RAM storagePower manager recovery dataInspect captured patch +1 / −6
diff --git a/core/embed/sys/power_manager/stm32u5/power_manager.c b/core/embed/sys/power_manager/stm32u5/power_manager.c
index 90534817c..239d3c702 100644
--- a/core/embed/sys/power_manager/stm32u5/power_manager.c
+++ b/core/embed/sys/power_manager/stm32u5/power_manager.c
@@ -451,12 +451,7 @@ pm_status_t pm_store_data_to_backup_ram() {
pm_recovery_data_t recovery = {.version = PM_RECOVERY_DATA_VERSION};
- // Fuel gauge state
- if (drv->battery_critical) {
- recovery.soc = 0;
- } else {
- recovery.soc = drv->fuel_gauge.soc;
- }
+ recovery.soc = drv->fuel_gauge.soc;
recovery.P = drv->fuel_gauge.P;
// Power manager state
Why this scored 30/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.