core: spmc: fix TOCTOU re-read in spmc_sp_add_nw_region() - #7965
Open
jenswikl wants to merge 1 commit into
Open
Conversation
spmc_sp_add_share() validates address_range_count and total_page_count from the NW shared FF-A memory transaction descriptor into local variables before calling spmc_sp_add_nw_region(), but that function re-read both fields directly from the NW-writable shared memory instead of using the validated values. A second CPU in the normal world could rewrite address_range_count between validation and use, driving the loop past the mapped RX buffer and causing a data abort that panics and halts all cores. Pass the validated addr_range_cnt and total_page_count down as parameters instead, matching the pattern already used for the SP path. Fixes: 5c1143a ("core: FFA_SHARE: Process FFA_MEM_SHARE message") Signed-off-by: Jens Wiklander <jens.wiklander@oss.qualcomm.com> Assisted-by: Claude:sonnet-5
jenswikl
force-pushed
the
fix-spmc-panic
branch
from
August 28, 2026 05:32
3d455af to
df68cd5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An SPMC fix from a previous security report that was demoted to a bug report.
I've used AI to create this fix.