Commit 65ffe80
committed
core: spmc: reject too small mem_access_size
The endpoint memory access descriptor array in an FF-A memory transaction
is described by mem_access_size, mem_access_count and mem_access_offs, read
from a normal-world (or SP) descriptor. spmc_read_mem_transaction() checks
that the array fits in the fragment but does not bound mem_access_size from
below.
Each array element is dereferenced as struct ffa_mem_access_common by its
users: get_acc_perms(), spmc_sp_add_share() and ffa_mem_retrieve(). With
mem_access_size smaller than that structure the array-fit check no longer
keeps each element read in range; with mem_access_size 0 and mem_access_offs
equal to frag_len the read lands past the mapped buffer, an out-of-bounds
read in the SPMC.
Check mem_access_size against sizeof(struct ffa_mem_access_common) in each
user of the descriptor, so every site validates the stride is large enough
for what it reads.
Signed-off-by: Guled Hasan <Law.Zoldyck@proton.me>1 parent a85cb55 commit 65ffe80
2 files changed
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
347 | 352 | | |
348 | 353 | | |
349 | 354 | | |
| |||
672 | 677 | | |
673 | 678 | | |
674 | 679 | | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
675 | 685 | | |
676 | 686 | | |
677 | 687 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1078 | 1078 | | |
1079 | 1079 | | |
1080 | 1080 | | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
1081 | 1084 | | |
1082 | 1085 | | |
1083 | 1086 | | |
| |||
0 commit comments