-
Notifications
You must be signed in to change notification settings - Fork 803
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
[rom_ext] Lock the correct ROM_EXT region #25892
base: earlgrey_es_sival
Are you sure you want to change the base?
Conversation
4f4bd24
to
c680f7f
Compare
uint32_t region_start = config->start; | ||
uint32_t region_end = region_start + config->size; | ||
|
||
// When applying the flash configuration, a region is a ROM_EXT region if |
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.
Thank you for the detailed comment! The comment and the logic don't quite match either other. I agree with the comment. The logic to match the comment would be
kRomExtAStart <= region_start < kRomExtAEnd &&
kRomExtAStart < region_end <= kRomExtAEnd
(and maybe we need an explicit region_start<=region_end
check too?)
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.
🤦 How embarrassing. A total logic fail.
I've fixed this and added unit tests to owner_block_unittest.cc
to test the overlap/exclusivity checking functions.
We don't need to test region_start <= region_end
because the bounds are computed from a start and size (which are uint16_t
) and the region_*
values are uint32_t
.
I added a sanity check to the end
value: if the end is beyond the total size of the flash, the configuration is invalid.
c680f7f
to
2e18d36
Compare
Ownership flash lockdown was protecting and locking all regions in the same slot that booted the owner code. However, the ROM_EXT and owner code don't have to boot from the same side of the flash. 1. Protect the ROM_EXT and owner regions each according to their boot slot. 2. Test each combination of ROM_EXT slot and owner slot in the `flash_permission_test`. Fixes lowRISC#25435. Signed-off-by: Chris Frantz <[email protected]>
2e18d36
to
7ca9842
Compare
Ownership flash lockdown was protecting and locking all regions in the same slot that booted the owner code. However, the ROM_EXT and owner code don't have to boot from the same side of the flash.
flash_permission_test
.Fixes #25435.