From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
qemu-devel@nongnu.org, Fam Zheng <famz@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Igor Mitsyanko <i.mitsyanko@gmail.com>,
mdroth@linux.vnet.ibm.com, qemu-stable@nongnu.org,
Amit Shah <amit.shah@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v5 02/24] vmstate: add VMS_MUST_EXIST
Date: Fri, 4 Apr 2014 10:54:59 +0100 [thread overview]
Message-ID: <20140404095458.GA2457@work-vm> (raw)
In-Reply-To: <87txa98m9b.fsf@elfo.mitica>
* Juan Quintela (quintela@redhat.com) wrote:
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > Can be used to verify a required field exists or validate
> > state in some other way.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>
>
> What should this do?
>
> We can change the semantics of ->field_exist() to add this functionality
> if needed, no?
Well that's what Michael is doing; he's changing the use of ->field_exist()
here, so that if this flag is set then a failure of field_exist causes a migration
failure.
Dave
>
> > ---
> > include/migration/vmstate.h | 1 +
> > vmstate.c | 10 ++++++++++
> > 2 files changed, 11 insertions(+)
> >
> > diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
> > index e7e1705..de970ab 100644
> > --- a/include/migration/vmstate.h
> > +++ b/include/migration/vmstate.h
> > @@ -100,6 +100,7 @@ enum VMStateFlags {
> > VMS_MULTIPLY = 0x200, /* multiply "size" field by field_size */
> > VMS_VARRAY_UINT8 = 0x400, /* Array with size in uint8_t field*/
> > VMS_VARRAY_UINT32 = 0x800, /* Array with size in uint32_t field*/
> > + VMS_MUST_EXIST = 0x1000, /* Field must exist in input */
> > };
> >
> > typedef struct {
> > diff --git a/vmstate.c b/vmstate.c
> > index dd6f834..f019228 100644
> > --- a/vmstate.c
> > +++ b/vmstate.c
> > @@ -102,6 +102,10 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
> > return ret;
> > }
> > }
> > + } else if (field->flags & VMS_MUST_EXIST) {
> > + fprintf(stderr, "Input validation failed: %s/%s\n",
> > + vmsd->name, field->name);
> > + return -1;
> > }
> > field++;
> > }
> > @@ -142,6 +146,12 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
> > field->info->put(f, addr, size);
> > }
> > }
> > + } else {
> > + if (field->flags & VMS_MUST_EXIST) {
> > + fprintf(stderr, "Output state validation failed: %s/%s\n",
> > + vmsd->name, field->name);
> > + assert(!(field->flags & VMS_MUST_EXIST));
> > + }
> > }
> > field++;
> > }
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
prev parent reply other threads:[~2014-04-04 9:55 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-03 16:50 [Qemu-devel] [PATCH v5 00/24] qemu state loading issues Michael S. Tsirkin
2014-04-03 16:50 ` [Qemu-devel] [PATCH v5 01/24] vmstate: reduce code duplication Michael S. Tsirkin
2014-04-04 9:37 ` Juan Quintela
2014-04-03 16:50 ` [Qemu-devel] [PATCH v5 03/24] vmstate: add VMSTATE_VALIDATE Michael S. Tsirkin
2014-04-03 16:50 ` [Qemu-devel] [PATCH v5 04/24] virtio-net: fix buffer overflow on invalid state load Michael S. Tsirkin
2014-04-03 16:50 ` [Qemu-devel] [PATCH v5 05/24] virtio-net: out-of-bounds buffer write on load Michael S. Tsirkin
2014-04-03 17:26 ` Peter Maydell
2014-04-03 16:50 ` [Qemu-devel] [PATCH v5 06/24] virtio-net: out-of-bounds buffer write on invalid state load Michael S. Tsirkin
2014-04-03 16:51 ` [Qemu-devel] [PATCH v5 07/24] virtio: " Michael S. Tsirkin
2014-04-03 16:51 ` [Qemu-devel] [PATCH v5 08/24] ahci: fix buffer overrun " Michael S. Tsirkin
2014-04-03 16:51 ` [Qemu-devel] [PATCH v5 09/24] hpet: " Michael S. Tsirkin
2014-04-04 9:51 ` Juan Quintela
2014-04-04 14:47 ` Michael S. Tsirkin
2014-04-04 15:04 ` Michael S. Tsirkin
2014-04-04 15:11 ` Michael S. Tsirkin
2014-04-03 16:51 ` [Qemu-devel] [PATCH v5 10/24] hw/pci/pcie_aer.c: fix buffer overruns " Michael S. Tsirkin
2014-04-03 16:51 ` [Qemu-devel] [PATCH v5 11/24] pl022: fix buffer overun " Michael S. Tsirkin
2014-04-03 16:51 ` [Qemu-devel] [PATCH v5 12/24] vmstate: fix buffer overflow in target-arm/machine.c Michael S. Tsirkin
2014-04-04 9:43 ` Juan Quintela
2014-04-03 16:51 ` [Qemu-devel] [PATCH v5 13/24] virtio: avoid buffer overrun on incoming migration Michael S. Tsirkin
2014-04-03 16:51 ` [Qemu-devel] [PATCH v5 14/24] openpic: " Michael S. Tsirkin
2014-04-03 18:04 ` Alexander Graf
2014-04-03 16:51 ` [Qemu-devel] [PATCH v5 15/24] virtio: validate num_sg when mapping Michael S. Tsirkin
2014-04-03 16:51 ` [Qemu-devel] [PATCH v5 16/24] pxa2xx: avoid buffer overrun on incoming migration Michael S. Tsirkin
2014-04-03 16:52 ` [Qemu-devel] [PATCH v5 17/24] ssi-sd: fix buffer overrun on invalid state load Michael S. Tsirkin
2014-04-03 17:05 ` Peter Maydell
2014-04-03 17:51 ` Michael S. Tsirkin
2014-04-03 16:52 ` [Qemu-devel] [PATCH v5 18/24] ssd0323: fix buffer overun " Michael S. Tsirkin
2014-04-03 17:13 ` Peter Maydell
2014-04-03 16:52 ` [Qemu-devel] [PATCH v5 19/24] tsc210x: fix buffer overrun " Michael S. Tsirkin
2014-04-03 16:52 ` [Qemu-devel] [PATCH v5 20/24] zaurus: " Michael S. Tsirkin
2014-04-03 16:52 ` [Qemu-devel] [PATCH v5 21/24] virtio-scsi: " Michael S. Tsirkin
2014-04-03 16:52 ` [Qemu-devel] [PATCH v5 22/24] vmstate: s/VMSTATE_INT32_LE/VMSTATE_INT32_POSITIVE_LE/ Michael S. Tsirkin
2014-04-04 9:43 ` Juan Quintela
2014-04-03 16:52 ` [Qemu-devel] [PATCH v5 23/24] usb: sanity check setup_index+setup_len in post_load Michael S. Tsirkin
2014-04-07 7:14 ` Gerd Hoffmann
2014-04-03 16:52 ` [Qemu-devel] [PATCH v5 24/24] savevm: Ignore minimum_version_id_old if there is no load_state_old Michael S. Tsirkin
2014-04-04 9:45 ` Juan Quintela
[not found] ` <1396543778-22307-3-git-send-email-mst@redhat.com>
2014-04-04 9:41 ` [Qemu-devel] [PATCH v5 02/24] vmstate: add VMS_MUST_EXIST Juan Quintela
2014-04-04 9:54 ` Dr. David Alan Gilbert [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140404095458.GA2457@work-vm \
--to=dgilbert@redhat.com \
--cc=amit.shah@redhat.com \
--cc=famz@redhat.com \
--cc=i.mitsyanko@gmail.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).