qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: marcandre.lureau@redhat.com, armbru@redhat.com,
	peterx@redhat.com, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] vl: Avoid crash when -mon is underspecified
Date: Wed, 24 Oct 2018 12:58:55 +0200	[thread overview]
Message-ID: <c5ea8c11-9e7e-fa87-e796-f574244364ee@redhat.com> (raw)
In-Reply-To: <20181023213600.364086-1-eblake@redhat.com>

On 23/10/18 23:35, Eric Blake wrote:
> A quick coredump on an incomplete command line:
> ./x86_64-softmmu/qemu-system-x86_64 -mon mode=control,pretty=on
> 
>   #0  0x00007ffff723d9e4 in g_str_hash () at /lib64/libglib-2.0.so.0
>   #1  0x00007ffff723ce38 in g_hash_table_lookup () at /lib64/libglib-2.0.so.0
>   #2  0x0000555555cc0073 in object_class_property_find (klass=0x5555566a94b0, name=0x0, errp=0x0) at qom/object.c:1135
>   #3  0x0000555555cc004b in object_class_property_find (klass=0x5555566a9440, name=0x0, errp=0x0) at qom/object.c:1129
>   #4  0x0000555555cbfe6e in object_property_find (obj=0x5555568348c0, name=0x0, errp=0x0) at qom/object.c:1080
>   #5  0x0000555555cc183d in object_resolve_path_component (parent=0x5555568348c0, part=0x0) at qom/object.c:1762
>   #6  0x0000555555d82071 in qemu_chr_find (name=0x0) at chardev/char.c:802
>   #7  0x00005555559d77cb in mon_init_func (opaque=0x0, opts=0x5555566b65a0, errp=0x0) at vl.c:2291
> 
> Fix it to instead fail gracefully.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>   vl.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/vl.c b/vl.c
> index 4e25c78bff0..2ed8672eb79 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2288,6 +2288,10 @@ static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp)
>       }
> 
>       chardev = qemu_opt_get(opts, "chardev");
> +    if (!chardev) {
> +        error_report("chardev is required");
> +        exit(1);
> +    }
>       chr = qemu_chr_find(chardev);
>       if (chr == NULL) {
>           error_report("chardev \"%s\" not found", chardev);
> 

  parent reply	other threads:[~2018-10-24 10:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23 21:35 [Qemu-devel] [PATCH] vl: Avoid crash when -mon is underspecified Eric Blake
2018-10-23 21:37 ` Paolo Bonzini
2018-10-24 10:58 ` Philippe Mathieu-Daudé [this message]
2018-10-24 11:32 ` Peter Xu
2018-10-30 16:36 ` Markus Armbruster

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=c5ea8c11-9e7e-fa87-e796-f574244364ee@redhat.com \
    --to=philmd@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@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 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).