-
Notifications
You must be signed in to change notification settings - Fork 7.2k
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
stream_flash: stream_flash_erase_page does not check whether requested offset is in range of stream flash owned area #79800
Labels
backport v3.7-branch
Request backport to the v3.7-branch
bug
The issue is a bug, or the PR is fixing a bug
priority: medium
Medium impact/importance bug
Comments
de-nordic
added a commit
to de-nordic/zephyr
that referenced
this issue
Oct 15, 2024
Added check where stream_flash_erase_page checks if requested offset is actually within stream flash designated area. Fixes zephyrproject-rtos#79800 Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
dleach02
pushed a commit
that referenced
this issue
Oct 25, 2024
Added check where stream_flash_erase_page checks if requested offset is actually within stream flash designated area. Fixes #79800 Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This was referenced Oct 30, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport v3.7-branch
Request backport to the v3.7-branch
bug
The issue is a bug, or the PR is fixing a bug
priority: medium
Medium impact/importance bug
Describe the bug
Stream Flash API provides
stream_flash_erase_page
function that, aside from other issues #67407, has a problem where it does not check whether requested, for erase, offset is within area designated for the stream flash the function is called on.Only performed check is whether currently requested offset has already been erased as exactly being offset of last erased page.
Above means that selecting any valid offset of page, that is not stored in stream flash ctx as erased, on the entire device allows to erase that offset, regardless whether that offset belongs to stream flash designated area or not.
To Reproduce
I have been able to emulate incorrect behavior by setting up stream flash on storage partition and performing erase of application by erasing its CONFIG_ROM_START_OFFSET, by doing sequence of operations:
the code above, has bricked device.
Expected behavior
Stream flash should only allow erasing what belongs to it.
Impact
Possible brick of device, data destruction.
Environment (please complete the following information):
Additional context
Not reported in field, probably because this is not used so much by users in outside of tree code, nevertheless it is quite a bug.
Marking as medium due to unpredictable destructive potential due to possible mistake in user code.
The problem exists since 2.3.0
The text was updated successfully, but these errors were encountered: