Browse Source

fix(el3-spmc): fix detection of overlapping memory regions

The current logic does not cover all scenarios of overlapping
memory regions. Update the implementation to verify non-overlapping
regions instead. Reported by Matt Oh, Google Android Red Team.

Reported-by: mattoh@google.com
Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
Change-Id: I16c53d081e4455bc0e28399d28a1b27b1a9eb49c
pull/1989/head
Marc Bonnici 2 years ago
committed by Joanna Farley
parent
commit
0dc3518666
  1. 7
      services/std_svc/spm/el3_spmc/spmc_shared_mem.c

7
services/std_svc/spm/el3_spmc/spmc_shared_mem.c

@ -330,10 +330,9 @@ overlapping_memory_regions(struct ffa_comp_mrd *region1,
PAGE_SIZE_4KB;
region2_end = region2_start + region2_size;
if ((region1_start >= region2_start &&
region1_start < region2_end) ||
(region1_end > region2_start
&& region1_end < region2_end)) {
/* Check if regions are not overlapping. */
if (!((region2_end <= region1_start) ||
(region1_end <= region2_start))) {
WARN("Overlapping mem regions 0x%lx-0x%lx & 0x%lx-0x%lx\n",
region1_start, region1_end,
region2_start, region2_end);

Loading…
Cancel
Save