* [Qemu-devel] [PATCH for-2.1 0/2] Fix crashes related to -global option @ 2014-07-03 19:45 Eduardo Habkost 2014-07-03 19:45 ` [Qemu-devel] [PATCH for-2.1 1/2] qdev: Don't abort() in case globals can't be set Eduardo Habkost 2014-07-03 19:45 ` [Qemu-devel] [PATCH for-2.1 2/2] qdev: Fix crash when using non-device class name on -global Eduardo Habkost 0 siblings, 2 replies; 6+ messages in thread From: Eduardo Habkost @ 2014-07-03 19:45 UTC (permalink / raw) To: qemu-devel, Andreas Färber Cc: Peter Maydell, Michael S. Tsirkin, Markus Armbruster, Don Slutz, Paolo Bonzini, Igor Mammedov Patch 1 (which was submitted previously but has fallen through the cracks) fixes: $ qemu-system-x86_64 -global cpu.xxx=y qemu-system-x86_64: Property '.xxx' not found Aborted (core dumped) Patch 2 fixes: $ qemu-system-x86_64 -global container.xxx=y hw/core/qdev-properties-system.c:399:qdev_add_one_global: Object 0x7f7eff234100 is not an instance of type device Aborted (core dumped) Eduardo Habkost (2): qdev: Don't abort() in case globals can't be set qdev: Fix crash when using non-device class name on -global hw/core/qdev-properties-system.c | 3 ++- hw/core/qdev.c | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) -- 1.9.3 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH for-2.1 1/2] qdev: Don't abort() in case globals can't be set 2014-07-03 19:45 [Qemu-devel] [PATCH for-2.1 0/2] Fix crashes related to -global option Eduardo Habkost @ 2014-07-03 19:45 ` Eduardo Habkost 2014-07-03 19:45 ` [Qemu-devel] [PATCH for-2.1 2/2] qdev: Fix crash when using non-device class name on -global Eduardo Habkost 1 sibling, 0 replies; 6+ messages in thread From: Eduardo Habkost @ 2014-07-03 19:45 UTC (permalink / raw) To: qemu-devel, Andreas Färber Cc: Peter Maydell, Michael S. Tsirkin, Markus Armbruster, Don Slutz, Paolo Bonzini, Igor Mammedov It would be much better if we didn't terminate QEMU inside device_post_init(), but at least exiting cleanly is better than aborting and dumping core. Before this patch: $ qemu-system-x86_64 -global cpu.xxx=y qemu-system-x86_64: Property '.xxx' not found Aborted (core dumped) After this patch: $ qemu-system-x86_64 -global cpu.xxx=y qemu-system-x86_64: Property '.xxx' not found Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-By: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- hw/core/qdev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 3bdda8e..da1ba48 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -957,7 +957,13 @@ static void device_initfn(Object *obj) static void device_post_init(Object *obj) { - qdev_prop_set_globals(DEVICE(obj), &error_abort); + Error *err = NULL; + qdev_prop_set_globals(DEVICE(obj), &err); + if (err) { + qerror_report_err(err); + error_free(err); + exit(EXIT_FAILURE); + } } /* Unlink device from bus and free the structure. */ -- 1.9.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH for-2.1 2/2] qdev: Fix crash when using non-device class name on -global 2014-07-03 19:45 [Qemu-devel] [PATCH for-2.1 0/2] Fix crashes related to -global option Eduardo Habkost 2014-07-03 19:45 ` [Qemu-devel] [PATCH for-2.1 1/2] qdev: Don't abort() in case globals can't be set Eduardo Habkost @ 2014-07-03 19:45 ` Eduardo Habkost 2014-07-03 20:25 ` Eric Blake 2014-07-07 6:41 ` Igor Mammedov 1 sibling, 2 replies; 6+ messages in thread From: Eduardo Habkost @ 2014-07-03 19:45 UTC (permalink / raw) To: qemu-devel, Andreas Färber Cc: Peter Maydell, Michael S. Tsirkin, Markus Armbruster, Don Slutz, Paolo Bonzini, Igor Mammedov This fixes the following crash: $ qemu-system-x86_64 -global container.xxx=y hw/core/qdev-properties-system.c:399:qdev_add_one_global: Object 0x7f7eff234100 is not an instance of type device Aborted (core dumped) New behavior will be to just warn, just like when non-existing clas names are used: $ qemu-system-x86_64 -global container.xxx=y qemu-system-x86_64: Warning: "-global container.xxx=y" not used Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- hw/core/qdev-properties-system.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 8e140af..ae0900f 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -394,7 +394,8 @@ static int qdev_add_one_global(QemuOpts *opts, void *opaque) g->driver = qemu_opt_get(opts, "driver"); g->property = qemu_opt_get(opts, "property"); g->value = qemu_opt_get(opts, "value"); - oc = object_class_by_name(g->driver); + oc = object_class_dynamic_cast(object_class_by_name(g->driver), + TYPE_DEVICE); if (oc) { DeviceClass *dc = DEVICE_CLASS(oc); -- 1.9.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.1 2/2] qdev: Fix crash when using non-device class name on -global 2014-07-03 19:45 ` [Qemu-devel] [PATCH for-2.1 2/2] qdev: Fix crash when using non-device class name on -global Eduardo Habkost @ 2014-07-03 20:25 ` Eric Blake 2014-07-03 21:42 ` Don Slutz 2014-07-07 6:41 ` Igor Mammedov 1 sibling, 1 reply; 6+ messages in thread From: Eric Blake @ 2014-07-03 20:25 UTC (permalink / raw) To: Eduardo Habkost, qemu-devel, Andreas Färber Cc: Peter Maydell, Michael S. Tsirkin, Markus Armbruster, Don Slutz, Paolo Bonzini, Igor Mammedov [-- Attachment #1: Type: text/plain, Size: 1627 bytes --] On 07/03/2014 01:45 PM, Eduardo Habkost wrote: > This fixes the following crash: > > $ qemu-system-x86_64 -global container.xxx=y > hw/core/qdev-properties-system.c:399:qdev_add_one_global: Object 0x7f7eff234100 is not an instance of type device > Aborted (core dumped) > > New behavior will be to just warn, just like when non-existing clas s/clas/class/ > names are used: > > $ qemu-system-x86_64 -global container.xxx=y > qemu-system-x86_64: Warning: "-global container.xxx=y" not used > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > --- > hw/core/qdev-properties-system.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c > index 8e140af..ae0900f 100644 > --- a/hw/core/qdev-properties-system.c > +++ b/hw/core/qdev-properties-system.c > @@ -394,7 +394,8 @@ static int qdev_add_one_global(QemuOpts *opts, void *opaque) > g->driver = qemu_opt_get(opts, "driver"); > g->property = qemu_opt_get(opts, "property"); > g->value = qemu_opt_get(opts, "value"); > - oc = object_class_by_name(g->driver); > + oc = object_class_dynamic_cast(object_class_by_name(g->driver), > + TYPE_DEVICE); > if (oc) { > DeviceClass *dc = DEVICE_CLASS(oc); I'm not an expert on the type system, but this one looks simple enough that I don't mind: Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 604 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.1 2/2] qdev: Fix crash when using non-device class name on -global 2014-07-03 20:25 ` Eric Blake @ 2014-07-03 21:42 ` Don Slutz 0 siblings, 0 replies; 6+ messages in thread From: Don Slutz @ 2014-07-03 21:42 UTC (permalink / raw) To: Eric Blake, Eduardo Habkost, qemu-devel, Andreas Färber Cc: Peter Maydell, Michael S. Tsirkin, Markus Armbruster, Don Slutz, Paolo Bonzini, Igor Mammedov On 07/03/14 16:25, Eric Blake wrote: > On 07/03/2014 01:45 PM, Eduardo Habkost wrote: >> This fixes the following crash: >> >> $ qemu-system-x86_64 -global container.xxx=y >> hw/core/qdev-properties-system.c:399:qdev_add_one_global: Object 0x7f7eff234100 is not an instance of type device >> Aborted (core dumped) >> >> New behavior will be to just warn, just like when non-existing clas > s/clas/class/ > >> names are used: >> >> $ qemu-system-x86_64 -global container.xxx=y >> qemu-system-x86_64: Warning: "-global container.xxx=y" not used >> >> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> >> --- >> hw/core/qdev-properties-system.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c >> index 8e140af..ae0900f 100644 >> --- a/hw/core/qdev-properties-system.c >> +++ b/hw/core/qdev-properties-system.c >> @@ -394,7 +394,8 @@ static int qdev_add_one_global(QemuOpts *opts, void *opaque) >> g->driver = qemu_opt_get(opts, "driver"); >> g->property = qemu_opt_get(opts, "property"); >> g->value = qemu_opt_get(opts, "value"); >> - oc = object_class_by_name(g->driver); >> + oc = object_class_dynamic_cast(object_class_by_name(g->driver), >> + TYPE_DEVICE); >> if (oc) { >> DeviceClass *dc = DEVICE_CLASS(oc); > I'm not an expert on the type system, but this one looks simple enough > that I don't mind: > > Reviewed-by: Eric Blake <eblake@redhat.com> > Looks good to me also, and it passes my quick tests. Tested-by: Don Slutz <dslutz@verizon.com> -Don Slutz ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.1 2/2] qdev: Fix crash when using non-device class name on -global 2014-07-03 19:45 ` [Qemu-devel] [PATCH for-2.1 2/2] qdev: Fix crash when using non-device class name on -global Eduardo Habkost 2014-07-03 20:25 ` Eric Blake @ 2014-07-07 6:41 ` Igor Mammedov 1 sibling, 0 replies; 6+ messages in thread From: Igor Mammedov @ 2014-07-07 6:41 UTC (permalink / raw) To: Eduardo Habkost Cc: Peter Maydell, Michael S. Tsirkin, qemu-devel, Don Slutz, Markus Armbruster, Paolo Bonzini, Andreas Färber On Thu, 3 Jul 2014 16:45:35 -0300 Eduardo Habkost <ehabkost@redhat.com> wrote: > This fixes the following crash: > > $ qemu-system-x86_64 -global container.xxx=y > hw/core/qdev-properties-system.c:399:qdev_add_one_global: Object 0x7f7eff234100 is not an instance of type device > Aborted (core dumped) > > New behavior will be to just warn, just like when non-existing clas > names are used: > > $ qemu-system-x86_64 -global container.xxx=y > qemu-system-x86_64: Warning: "-global container.xxx=y" not used > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > --- > hw/core/qdev-properties-system.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c > index 8e140af..ae0900f 100644 > --- a/hw/core/qdev-properties-system.c > +++ b/hw/core/qdev-properties-system.c > @@ -394,7 +394,8 @@ static int qdev_add_one_global(QemuOpts *opts, void *opaque) > g->driver = qemu_opt_get(opts, "driver"); > g->property = qemu_opt_get(opts, "property"); > g->value = qemu_opt_get(opts, "value"); > - oc = object_class_by_name(g->driver); > + oc = object_class_dynamic_cast(object_class_by_name(g->driver), > + TYPE_DEVICE); > if (oc) { > DeviceClass *dc = DEVICE_CLASS(oc); > Reviewed-by: Igor Mammedov <imammedo@redhat.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-07-07 6:42 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-07-03 19:45 [Qemu-devel] [PATCH for-2.1 0/2] Fix crashes related to -global option Eduardo Habkost 2014-07-03 19:45 ` [Qemu-devel] [PATCH for-2.1 1/2] qdev: Don't abort() in case globals can't be set Eduardo Habkost 2014-07-03 19:45 ` [Qemu-devel] [PATCH for-2.1 2/2] qdev: Fix crash when using non-device class name on -global Eduardo Habkost 2014-07-03 20:25 ` Eric Blake 2014-07-03 21:42 ` Don Slutz 2014-07-07 6:41 ` Igor Mammedov
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).