From 602f8ea79ce39b7bd6d2e22c686ef05227e1876b Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Tue, 27 Jul 2021 10:25:43 +0200 Subject: softmmu/memory_mapping: never merge ranges accross memory regions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's make sure to not merge when different memory regions are involved. Unlikely, but theoretically possible. Acked-by: Stefan Berger Reviewed-by: Peter Xu Cc: Marc-André Lureau Cc: Paolo Bonzini Cc: "Michael S. Tsirkin" Cc: Eduardo Habkost Cc: Alex Williamson Cc: Dr. David Alan Gilbert Cc: Igor Mammedov Cc: Claudio Fontana Cc: Thomas Huth Cc: "Alex Bennée" Cc: Peter Xu Cc: Laurent Vivier Cc: Stefan Berger Signed-off-by: David Hildenbrand Message-Id: <20210727082545.17934-3-david@redhat.com> Signed-off-by: Paolo Bonzini --- softmmu/memory_mapping.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'softmmu/memory_mapping.c') diff --git a/softmmu/memory_mapping.c b/softmmu/memory_mapping.c index e7af276546..d401ca7e31 100644 --- a/softmmu/memory_mapping.c +++ b/softmmu/memory_mapping.c @@ -229,7 +229,8 @@ static void guest_phys_blocks_region_add(MemoryListener *listener, /* we want continuity in both guest-physical and host-virtual memory */ if (predecessor->target_end < target_start || - predecessor->host_addr + predecessor_size != host_addr) { + predecessor->host_addr + predecessor_size != host_addr || + predecessor->mr != section->mr) { predecessor = NULL; } } -- cgit v1.2.3