From: "Michael S. Tsirkin" <m...@redhat.com> Lookup of address > target address space should return an unassigned section, instead of silently ignoring high bits.
Reported-by: Luiz Capitulino <lcapitul...@redhat.com> Signed-off-by: Michael S. Tsirkin <m...@redhat.com> Signed-off-by: Marcel Apfelbaum <marce...@redhat.com> --- exec.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/exec.c b/exec.c index 79610ce..aeeaf00 100644 --- a/exec.c +++ b/exec.c @@ -197,6 +197,9 @@ static void phys_page_set_level(PhysPageEntry *lp, hwaddr *index, } } +#define TARGET_PHYS_MAX_ADDR \ + (0x1ULL << (TARGET_PHYS_ADDR_SPACE_BITS - TARGET_PAGE_BITS)) + static void phys_page_set(AddressSpaceDispatch *d, hwaddr index, hwaddr nb, uint16_t leaf) @@ -213,6 +216,10 @@ static MemoryRegionSection *phys_page_find(PhysPageEntry lp, hwaddr index, PhysPageEntry *p; int i; + if (index >= TARGET_PHYS_MAX_ADDR) { + return §ions[PHYS_SECTION_UNASSIGNED]; + } + for (i = P_L2_LEVELS - 1; i >= 0 && !lp.is_leaf; i--) { if (lp.ptr == PHYS_MAP_NODE_NIL) { return §ions[PHYS_SECTION_UNASSIGNED]; -- 1.8.3.1