From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38484) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUec2-0006Mj-TD for qemu-devel@nongnu.org; Thu, 09 Jun 2011 08:45:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUec0-0005sP-Lq for qemu-devel@nongnu.org; Thu, 09 Jun 2011 08:45:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44787) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUec0-0005sB-5N for qemu-devel@nongnu.org; Thu, 09 Jun 2011 08:45:24 -0400 Message-ID: <4DF0C100.2040200@redhat.com> Date: Thu, 09 Jun 2011 14:48:00 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1295861427-30851-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> In-Reply-To: <1295861427-30851-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] savevm: fix corruption in vmstate_subsection_load(). List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yoshiaki Tamura Cc: pbonzini@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, quintela@redhat.com Am 24.01.2011 10:30, schrieb Yoshiaki Tamura: > Although it's rare to happen in live migration, when the head of a > byte stream contains 0x05 which is the marker of subsection, the > loader gets corrupted because vmstate_subsection_load() continues even > the device doesn't require it. This patch adds a checker whether > subsection is needed, and skips following routines if not needed. > > Signed-off-by: Yoshiaki Tamura > --- > savevm.c | 10 +++++++++- > 1 files changed, 9 insertions(+), 1 deletions(-) > > diff --git a/savevm.c b/savevm.c > index fcd8db4..3be875d 100644 > --- a/savevm.c > +++ b/savevm.c > @@ -1639,6 +1639,12 @@ static const VMStateDescription *vmstate_get_subsection(const VMStateSubsection > static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd, > void *opaque) > { > + const VMStateSubsection *sub = vmsd->subsections; > + > + if (!sub || !sub->needed) { > + return 0; > + } This means that subsections are silently ignored if the old version didn't have any subsection for the device. Wasn't it a fundamental point of the design of subsections that this would fail? Noticed this when trying to use subsections to fix up IDE, and new -> old migration after an I/O error only correctly fails when I revert this patch. Kevin