qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Apfelbaum <marcel@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Marcel Apfelbaum <marcel.a@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] hostmem: Fix qemu_opt_get_bool() crash in host_memory_backend_init()
Date: Fri, 17 Jul 2015 10:21:29 +0300	[thread overview]
Message-ID: <55A8ACF9.1090303@redhat.com> (raw)
In-Reply-To: <1437079157-6316-1-git-send-email-ehabkost@redhat.com>

On 07/16/2015 11:39 PM, Eduardo Habkost wrote:
> This fixes the following crash, introduced by commit
> 49d2e648e8087d154d8bf8b91f27c8e05e79d5a6:
>
>    $ gdb --args qemu-system-x86_64 -machine pc,mem-merge=off -object memory-backend-ram,id=ram-node0,size=1024
>    [...]
>    Program received signal SIGABRT, Aborted.
>    (gdb) bt
>    #0  0x00007ffff253b8c7 in raise () at /lib64/libc.so.6
>    #1  0x00007ffff253d52a in abort () at /lib64/libc.so.6
>    #2  0x00007ffff253446d in __assert_fail_base () at /lib64/libc.so.6
>    #3  0x00007ffff2534522 in  () at /lib64/libc.so.6
>    #4  0x00005555558bb80a in qemu_opt_get_bool_helper (opts=0x55555621b650, name=name@entry=0x5555558ec922 "mem-merge", defval=defval@entry=true, del=del@entry=false) at qemu/util/qemu-option.c:388
>    #5  0x00005555558bbb5a in qemu_opt_get_bool (opts=<optimized out>, name=name@entry=0x5555558ec922 "mem-merge", defval=defval@entry=true) at qemu/util/qemu-option.c:398
>    #6  0x0000555555720a24 in host_memory_backend_init (obj=0x5555562ac970) at qemu/backends/hostmem.c:226
>
> Instead of using qemu_opt_get_bool(), that didn't work with
> qemu_machine_opts for a long time, we can use the machine QOM properties
> directly.
This was the intent.

>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>   backends/hostmem.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/backends/hostmem.c b/backends/hostmem.c
> index 61c1ac0..38a32ed 100644
> --- a/backends/hostmem.c
> +++ b/backends/hostmem.c
> @@ -10,6 +10,7 @@
>    * See the COPYING file in the top-level directory.
>    */
>   #include "sysemu/hostmem.h"
> +#include "hw/boards.h"
>   #include "qapi/visitor.h"
>   #include "qapi-types.h"
>   #include "qapi-visit.h"
> @@ -223,10 +224,10 @@ static void host_memory_backend_init(Object *obj)
>   {
>       HostMemoryBackend *backend = MEMORY_BACKEND(obj);
>
> -    backend->merge = qemu_opt_get_bool(qemu_get_machine_opts(),
> -                                       "mem-merge", true);
> -    backend->dump = qemu_opt_get_bool(qemu_get_machine_opts(),
> -                                      "dump-guest-core", true);
> +    backend->merge = object_property_get_bool(OBJECT(current_machine),
> +                                              "mem-merge", &error_abort);
> +    backend->dump = object_property_get_bool(OBJECT(current_machine),
> +                                            "dump-guest-core", &error_abort);
>       backend->prealloc = mem_prealloc;
>
>       object_property_add_bool(obj, "merge",
>

Thank you for fixing this,

Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>

      parent reply	other threads:[~2015-07-17  7:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-16 20:39 [Qemu-devel] [PATCH] hostmem: Fix qemu_opt_get_bool() crash in host_memory_backend_init() Eduardo Habkost
2015-07-16 21:02 ` Igor Mammedov
2015-07-17 20:33   ` Eduardo Habkost
2015-07-20  7:06     ` Igor Mammedov
2015-07-20 20:03       ` Eduardo Habkost
2015-07-20 20:06         ` Marcel Apfelbaum
2015-07-17  7:21 ` Marcel Apfelbaum [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=55A8ACF9.1090303@redhat.com \
    --to=marcel@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=marcel.a@redhat.com \
    --cc=pbonzini@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).