summaryrefslogtreecommitdiff
path: root/services/std_svc
diff options
context:
space:
mode:
authorDemi Marie Obenour <demiobenour@gmail.com>2023-01-15 15:31:45 -0500
committerDemi Marie Obenour <demiobenour@gmail.com>2023-06-20 11:18:05 -0400
commit327b5b8b74faedefc45e861c797197cf6fbd6def (patch)
treefe5e81fbe63baaf9f6455ac569b4e63b205e208c /services/std_svc
parente779c1afe23dc087d93f5b8af4c9a9240cab98a3 (diff)
fix(el3-spmc): validate memory address alignment
This ensures that addresses shared using FF-A are 4K aligned, as required by the specification. Change-Id: I8f0a659a095fdb9391398757141d613ac9bf9b42 Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
Diffstat (limited to 'services/std_svc')
-rw-r--r--services/std_svc/spm/el3_spmc/spmc_shared_mem.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/services/std_svc/spm/el3_spmc/spmc_shared_mem.c b/services/std_svc/spm/el3_spmc/spmc_shared_mem.c
index 15c7e91da..44d98afc4 100644
--- a/services/std_svc/spm/el3_spmc/spmc_shared_mem.c
+++ b/services/std_svc/spm/el3_spmc/spmc_shared_mem.c
@@ -898,8 +898,15 @@ static int spmc_shmem_check_obj(struct spmc_shmem_obj *obj,
total_page_count = 0;
for (size_t i = 0; i < count; i++) {
- total_page_count +=
- comp->address_range_array[i].page_count;
+ const struct ffa_cons_mrd *mrd = comp->address_range_array + i;
+
+ if (!is_aligned(mrd->address, PAGE_SIZE)) {
+ WARN("%s: invalid object, address in region descriptor "
+ "%zu not 4K aligned (got 0x%016llx)",
+ __func__, i, (unsigned long long)mrd->address);
+ }
+
+ total_page_count += mrd->page_count;
}
if (comp->total_page_count != total_page_count) {
WARN("%s: invalid object, desc total_page_count %u != %" PRIu64 "\n",