From: "Marc-André Lureau" <mlureau@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
qemu-devel@nongnu.org, berto@igalia.com
Subject: Re: [Qemu-devel] [PATCH 1/3] qapi: return a 'missing parameter' error
Date: Wed, 21 Sep 2016 12:07:52 -0400 (EDT) [thread overview]
Message-ID: <1730633132.491556.1474474072544.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <87bmzhz5jx.fsf@dusky.pond.sub.org>
Hi
----- Original Message -----
> Aha, we got a different bug fix! The old code fails to fail when the
> parameter doesn't exist. Instead, it sets *obj = NULL, which seems very
> likely to crash QEMU. Let me try... yup:
>
> { "execute": "object-add",
> "arguments": { "qom-type": "memory-backend-file", "id": "foo" } }
>
> Kills QEMU with "qemu/qom/object_interfaces.c:115: user_creatable_add_type:
> Assertion `qdict' failed."
>
> Either fix this in a separate patch before this one, or cover it in this
> one's commit message. Your choice.
>
> A separate patch might be usable for qemu-stable.
It looks to me that this is a different bug.
visit_type_q_obj_object_add_arg_members() doesn't call visit_type_any() if "props" is missing (it's optionnal).
And arg is zero'ed in qmp-marshal, and the assert() was added in ad739706bbadee49. I am trying to fix that regression.
>
> > @@ -345,8 +379,11 @@ static void qmp_input_type_any(Visitor *v, const char
> > *name, QObject **obj,
> > static void qmp_input_type_null(Visitor *v, const char *name, Error
> > **errp)
> > {
> > QmpInputVisitor *qiv = to_qiv(v);
> > - QObject *qobj = qmp_input_get_object(qiv, name, true);
> > + QObject *qobj = qmp_input_get_object(qiv, name, true, errp);
> >
> > + if (!qobj) {
> > + return;
> > + }
> > if (qobject_type(qobj) != QTYPE_QNULL) {
> > error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name :
> > "null",
> > "null");
>
> Same bug, I think, but I don't have a reproducer handy.
>
> > @@ -356,7 +393,7 @@ static void qmp_input_type_null(Visitor *v, const char
> > *name, Error **errp)
> > static void qmp_input_optional(Visitor *v, const char *name, bool
> > *present)
> > {
> > QmpInputVisitor *qiv = to_qiv(v);
> > - QObject *qobj = qmp_input_get_object(qiv, name, false);
> > + QObject *qobj = qmp_input_get_object(qiv, name, false, NULL);
> >
> > if (!qobj) {
> > *present = false;
>
> Thanks for following my suggestion to move the "Parameter FOO is
> missing" error into qmp_input_get_object()! You fixed two crash bugs
> that way :)
>
next prev parent reply other threads:[~2016-09-21 16:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-21 10:36 [Qemu-devel] [PATCH 0/3] qapi: return 'missing parameter' error Marc-André Lureau
2016-09-21 10:36 ` [Qemu-devel] [PATCH 1/3] qapi: return a " Marc-André Lureau
2016-09-21 12:57 ` Alberto Garcia
2016-09-21 14:33 ` Markus Armbruster
2016-09-21 15:05 ` Marc-André Lureau
2016-09-21 16:07 ` Marc-André Lureau [this message]
2016-09-22 11:02 ` Markus Armbruster
2016-09-21 10:36 ` [Qemu-devel] [PATCH 2/3] qapi: clear given pointer Marc-André Lureau
2016-09-21 12:57 ` Alberto Garcia
2016-09-21 14:41 ` Daniel P. Berrange
2016-09-21 15:17 ` Marc-André Lureau
2016-09-21 15:34 ` Daniel P. Berrange
2016-09-21 15:24 ` Markus Armbruster
2016-09-21 10:36 ` [Qemu-devel] [PATCH 3/3] iotests: fix expected error message Marc-André Lureau
2016-09-21 12:58 ` Alberto Garcia
2016-09-21 15:14 ` Markus Armbruster
2016-09-21 15:32 ` Marc-André Lureau
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=1730633132.491556.1474474072544.JavaMail.zimbra@redhat.com \
--to=mlureau@redhat.com \
--cc=armbru@redhat.com \
--cc=berto@igalia.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
/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.