Skip to content

core: spmc: fix TOCTOU re-read in spmc_sp_add_nw_region() - #7965

Open
jenswikl wants to merge 1 commit into
OP-TEE:masterfrom
jenswikl:fix-spmc-panic
Open

core: spmc: fix TOCTOU re-read in spmc_sp_add_nw_region()#7965
jenswikl wants to merge 1 commit into
OP-TEE:masterfrom
jenswikl:fix-spmc-panic

Conversation

@jenswikl

Copy link
Copy Markdown
Contributor

An SPMC fix from a previous security report that was demoted to a bug report.

I've used AI to create this fix.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant