From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgqS8-0006Ig-8w for qemu-devel@nongnu.org; Tue, 29 Sep 2015 04:40:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZgqS5-0002QU-CD for qemu-devel@nongnu.org; Tue, 29 Sep 2015 04:40:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54863) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgqS5-0002QO-75 for qemu-devel@nongnu.org; Tue, 29 Sep 2015 04:39:57 -0400 From: "Dr. David Alan Gilbert (git)" Date: Tue, 29 Sep 2015 09:38:10 +0100 Message-Id: <1443515898-3594-47-git-send-email-dgilbert@redhat.com> In-Reply-To: <1443515898-3594-1-git-send-email-dgilbert@redhat.com> References: <1443515898-3594-1-git-send-email-dgilbert@redhat.com> Subject: [Qemu-devel] [PATCH v8 46/54] postcopy: Check order of received target pages List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, quintela@redhat.com, amit.shah@redhat.com Cc: aarcange@redhat.com, pbonzini@redhat.com, liang.z.li@intel.com, luis@cs.umu.se, bharata@linux.vnet.ibm.com From: "Dr. David Alan Gilbert" Ensure that target pages received within a host page are in order. This shouldn't trigger, but in the cases where the sender goes wrong and sends stuff out of order it produces a corruption that's really nasty to debug. Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index d6437be..8b1570d 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2212,6 +2212,7 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) void *postcopy_host_page = NULL; bool postcopy_place_needed = false; bool matching_page_sizes = qemu_host_page_size == TARGET_PAGE_SIZE; + void *last_host = NULL; seq_iter++; @@ -2264,6 +2265,14 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) /* If all TP are zero then we can optimise the place */ if (!((uintptr_t)host & ~qemu_host_page_mask)) { all_zero = true; + } else { + /* not the 1st TP within the HP */ + if (host != (last_host + TARGET_PAGE_SIZE)) { + error_report("Non-sequential target page %p/%p\n", + host, last_host); + ret = -EINVAL; + break; + } } /* @@ -2274,6 +2283,7 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) ~qemu_host_page_mask) == 0; postcopy_place_source = postcopy_host_page; } + last_host = host; } switch (flags & ~RAM_SAVE_FLAG_CONTINUE) { -- 2.5.0