-
Notifications
You must be signed in to change notification settings - Fork 1.4k
mcumgr: Prevent FW loader from self-destruction #26152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
mcumgr: Prevent FW loader from self-destruction #26152
Conversation
The FW loader reports and manages exactly two slots: - slot 0: this is the slot for the application code to update - slot 1: this is the slot, in which the FW loader is placed The slot 1 is reported, so tools can fetch metadata about the FW loader installed on the device. Unfortunately, currently SMP-based FW loader allows to issue slot erase command for the slot 1, effectively erasing the FW loader code that is being executed. This change correctly identifies the slot 1 as an active one, marking it as used and blocking erase operation on that slot. Ref: NCSDK-36684 Signed-off-by: Tomasz Chyrowicz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR prevents the firmware loader from erasing itself by correctly identifying its own slot (slot 1) as active and in-use. Previously, the firmware loader would allow erase commands on slot 1, which would destroy the running firmware loader code.
- Removes the early return that always reported slot 1 as unused in firmware updater mode
- Adds
CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATERto the conditional logic that determines if a slot is in use - Updates the Zephyr revision to incorporate related changes
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| west.yml | Updates Zephyr revision to pull/3617/head to integrate upstream changes |
| subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c | Fixes slot-in-use detection for firmware updater mode by restructuring preprocessor conditionals |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The following west manifest projects have changed revision in this Pull Request:
⛔ DNM label due to: 1 project with PR revision Note: This message is automatically posted and updated by the Manifest GitHub Action. |
CI InformationTo view the history of this post, click the 'edited' button above Inputs:Sources:sdk-nrf: PR head: 98aaab7b3ad2a24eda8f969ef449a89079aee2dc more detailssdk-nrf:
zephyr:
Github labels
List of changed files detected by CI (4)Outputs:ToolchainVersion: 43683a87ea Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped;
|
|
You can find the documentation preview for this PR here. |
The FW loader reports and manages exactly two slots:
The slot 1 is reported, so tools can fetch metadata about the FW loader installed on the device.
Unfortunately, currently SMP-based FW loader allows to issue slot erase command for the slot 1, effectively erasing the FW loader code that is being executed.
This change correctly identifies the slot 1 as an active one, marking it as used and blocking erase operation on that slot.
Ref: NCSDK-36684