From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Juan Quintela <quintela@redhat.com>,
Amit Shah <amit.shah@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/3] vmstate registration: check return values
Date: Tue, 10 Jan 2017 10:34:00 +0000 [thread overview]
Message-ID: <20170110103400.GC2423@work-vm> (raw)
In-Reply-To: <CAFEAcA8rZa7qxFeog=wj2n4umCsjOCqM46m7MDR3PW=Rh8sBug@mail.gmail.com>
* Peter Maydell (peter.maydell@linaro.org) wrote:
> On 10 January 2017 at 09:26, Dr. David Alan Gilbert <dgilbert@redhat.com> wrote:
> > * Peter Maydell (peter.maydell@linaro.org) wrote:
> >> On 9 January 2017 at 20:13, Dr. David Alan Gilbert (git)
> >> <dgilbert@redhat.com> wrote:
> >> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >> >
> >> > Check qdev's call to vmstate_register_with_alias_id; that gets
> >> > most of the common uses; there's hundreds of calls via vmstate_register
> >> > which could get fixed over time.
> >>
> >> Not quite that bad, I think -- I make it just over 50 calls.
> >
> > Well kind of; it seems to be a bit more complicated than that.
> > I'd grep'd for vmstate_register and that gives me ~180 (including
> > stuff in headers).
>
> Yes, I was specifically looking at the vmstate_register and
> vmstate_register_with_alias_id ones.
>
> > Only 56 of those are vmstate_register() calls though, 117 are
> > vmstate_register_ram calls which I'd not previously looked at,
> > those call qemu_ram_set_idstr which looks like it suffers from
> > the same problem though.
>
> They call qemu_ram_set_idstr with the memory region name string,
> though, which is "used for debugging; not visible to the user
> or ABI", so we can just say it's a bug to use a silly name
> and assert if it's too big, right?
qemu_ram_set_idstr already abort's if it hits a dupe (which after
making sure it doesn't overflow the buffer is what we end up with
if we have long names); so yes we already abort in that case.
However, it's a bit optimistic of the memory region to claim the name
is just for debug; Migration/ram.c transmits the RAMBlock's idstr on
the wire (as does postcopy) - so I think the memory.h comment
is wrong.
I don't think it's a big problem since you're unlikely to hit these
big names in practice; but it would be better to return an error
rather than assert/abort since then you wouldn't abort as part
of a hot-add.
So it's worth taking the common cases as this patch does; I don't
think it's worth the hastle of changing 100+ calls though.
Dave
> thanks
> -- PMM
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2017-01-10 10:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-09 20:13 [Qemu-devel] [PATCH 0/3] Protect against long IDs Dr. David Alan Gilbert (git)
2017-01-09 20:13 ` [Qemu-devel] [PATCH 1/3] vmstate_register_with_alias_id: Take an Error ** Dr. David Alan Gilbert (git)
2017-02-01 12:56 ` Juan Quintela
2017-01-09 20:13 ` [Qemu-devel] [PATCH 2/3] migration: Check for ID length Dr. David Alan Gilbert (git)
2017-02-01 12:57 ` Juan Quintela
2017-01-09 20:13 ` [Qemu-devel] [PATCH 3/3] vmstate registration: check return values Dr. David Alan Gilbert (git)
2017-01-09 21:39 ` Peter Maydell
2017-01-10 9:26 ` Dr. David Alan Gilbert
2017-01-10 10:10 ` Peter Maydell
2017-01-10 10:34 ` Dr. David Alan Gilbert [this message]
2017-01-10 10:44 ` Peter Maydell
2017-02-01 12:58 ` Juan Quintela
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=20170110103400.GC2423@work-vm \
--to=dgilbert@redhat.com \
--cc=amit.shah@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.