* [Qemu-devel] [PATCH] qdev: fix -device scsi-hd,help regression
@ 2019-01-09 10:23 Marc-André Lureau
2019-01-09 10:42 ` Cornelia Huck
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Marc-André Lureau @ 2019-01-09 10:23 UTC (permalink / raw)
To: qemu-devel; +Cc: imammedo, cohuck, ehabkost, Marc-André Lureau
Since commit ea9ce8934, device_post_init() applies globals directly
from machines and accelerator classes.
There are cases, such as -device scsi-hd,help, where the machine is
setup but there in no accelerator.
Let's skip accelerator globals in this case.
Fixes SEGV:
#0 0x0000555558ea04ff in object_get_class (obj=0x0) at /home/elmarco/src/qemu/build/../qom/object.c:857
#1 0x000055555854c797 in object_apply_compat_props (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:978
#2 0x000055555854c797 in object_apply_compat_props (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:973
#3 0x000055555854c959 in device_post_init (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:989
#4 0x0000555558e9e250 in object_post_init_with_type (ti=<optimized out>, obj=0x616000078980) at /home/elmarco/src/qemu/build/../qom/object.c:365
#5 0x0000555558e9e250 in object_initialize_with_type (data=0x616000078980, size=616, type=<optimized out>) at /home/elmarco/src/qemu/build/../qom/object.c:425
#6 0x0000555558e9e571 in object_new_with_type (type=0x613000031900) at /home/elmarco/src/qemu/build/../qom/object.c:588
#7 0x000055555830c048 in qmp_device_list_properties (typename=typename@entry=0x60200000c2d0 "scsi-hd", errp=errp@entry=0x7fffffffc540) at /home/elmarco/src/qemu/qmp.c:519
#8 0x00005555582c4027 in qdev_device_help (opts=<optimized out>) at /home/elmarco/src/qemu/qdev-monitor.c:283
#9 0x0000555559378fa2 in qemu_opts_foreach (list=<optimized out>, func=func@entry=0x5555582cfca0 <device_help_func>, opaque=opaque@entry=0x0, errp=errp@entry=0x0) at /home/elmarco/src/qemu/util/qemu-option.c:1171
https://bugzilla.redhat.com/show_bug.cgi?id=1664364
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
hw/core/qdev.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 3769a2bccb..47bddacb4f 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -975,10 +975,13 @@ void object_apply_compat_props(Object *obj)
if (object_dynamic_cast(qdev_get_machine(), TYPE_MACHINE)) {
MachineState *m = MACHINE(qdev_get_machine());
MachineClass *mc = MACHINE_GET_CLASS(m);
- AccelClass *ac = ACCEL_GET_CLASS(m->accelerator);
- if (ac->compat_props) {
- object_apply_global_props(obj, ac->compat_props, &error_abort);
+ if (m->accelerator) {
+ AccelClass *ac = ACCEL_GET_CLASS(m->accelerator);
+
+ if (ac->compat_props) {
+ object_apply_global_props(obj, ac->compat_props, &error_abort);
+ }
}
object_apply_global_props(obj, mc->compat_props, &error_abort);
}
--
2.20.1.2.gb21ebb671b
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] qdev: fix -device scsi-hd,help regression
2019-01-09 10:23 [Qemu-devel] [PATCH] qdev: fix -device scsi-hd,help regression Marc-André Lureau
@ 2019-01-09 10:42 ` Cornelia Huck
2019-01-09 16:07 ` Lukáš Doktor
2019-01-09 16:12 ` Igor Mammedov
2 siblings, 0 replies; 4+ messages in thread
From: Cornelia Huck @ 2019-01-09 10:42 UTC (permalink / raw)
To: Marc-André Lureau; +Cc: qemu-devel, imammedo, ehabkost
On Wed, 9 Jan 2019 14:23:11 +0400
Marc-André Lureau <marcandre.lureau@redhat.com> wrote:
> Since commit ea9ce8934, device_post_init() applies globals directly
> from machines and accelerator classes.
>
> There are cases, such as -device scsi-hd,help, where the machine is
> setup but there in no accelerator.
>
> Let's skip accelerator globals in this case.
>
> Fixes SEGV:
> #0 0x0000555558ea04ff in object_get_class (obj=0x0) at /home/elmarco/src/qemu/build/../qom/object.c:857
> #1 0x000055555854c797 in object_apply_compat_props (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:978
> #2 0x000055555854c797 in object_apply_compat_props (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:973
> #3 0x000055555854c959 in device_post_init (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:989
> #4 0x0000555558e9e250 in object_post_init_with_type (ti=<optimized out>, obj=0x616000078980) at /home/elmarco/src/qemu/build/../qom/object.c:365
> #5 0x0000555558e9e250 in object_initialize_with_type (data=0x616000078980, size=616, type=<optimized out>) at /home/elmarco/src/qemu/build/../qom/object.c:425
> #6 0x0000555558e9e571 in object_new_with_type (type=0x613000031900) at /home/elmarco/src/qemu/build/../qom/object.c:588
> #7 0x000055555830c048 in qmp_device_list_properties (typename=typename@entry=0x60200000c2d0 "scsi-hd", errp=errp@entry=0x7fffffffc540) at /home/elmarco/src/qemu/qmp.c:519
> #8 0x00005555582c4027 in qdev_device_help (opts=<optimized out>) at /home/elmarco/src/qemu/qdev-monitor.c:283
> #9 0x0000555559378fa2 in qemu_opts_foreach (list=<optimized out>, func=func@entry=0x5555582cfca0 <device_help_func>, opaque=opaque@entry=0x0, errp=errp@entry=0x0) at /home/elmarco/src/qemu/util/qemu-option.c:1171
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1664364
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> hw/core/qdev.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] qdev: fix -device scsi-hd,help regression
2019-01-09 10:23 [Qemu-devel] [PATCH] qdev: fix -device scsi-hd,help regression Marc-André Lureau
2019-01-09 10:42 ` Cornelia Huck
@ 2019-01-09 16:07 ` Lukáš Doktor
2019-01-09 16:12 ` Igor Mammedov
2 siblings, 0 replies; 4+ messages in thread
From: Lukáš Doktor @ 2019-01-09 16:07 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel; +Cc: imammedo, cohuck, ehabkost
[-- Attachment #1: Type: text/plain, Size: 3070 bytes --]
Dne 09. 01. 19 v 11:23 Marc-André Lureau napsal(a):
> Since commit ea9ce8934, device_post_init() applies globals directly
> from machines and accelerator classes.
>
> There are cases, such as -device scsi-hd,help, where the machine is
> setup but there in no accelerator.
>
> Let's skip accelerator globals in this case.
>
> Fixes SEGV:
> #0 0x0000555558ea04ff in object_get_class (obj=0x0) at /home/elmarco/src/qemu/build/../qom/object.c:857
> #1 0x000055555854c797 in object_apply_compat_props (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:978
> #2 0x000055555854c797 in object_apply_compat_props (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:973
> #3 0x000055555854c959 in device_post_init (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:989
> #4 0x0000555558e9e250 in object_post_init_with_type (ti=<optimized out>, obj=0x616000078980) at /home/elmarco/src/qemu/build/../qom/object.c:365
> #5 0x0000555558e9e250 in object_initialize_with_type (data=0x616000078980, size=616, type=<optimized out>) at /home/elmarco/src/qemu/build/../qom/object.c:425
> #6 0x0000555558e9e571 in object_new_with_type (type=0x613000031900) at /home/elmarco/src/qemu/build/../qom/object.c:588
> #7 0x000055555830c048 in qmp_device_list_properties (typename=typename@entry=0x60200000c2d0 "scsi-hd", errp=errp@entry=0x7fffffffc540) at /home/elmarco/src/qemu/qmp.c:519
> #8 0x00005555582c4027 in qdev_device_help (opts=<optimized out>) at /home/elmarco/src/qemu/qdev-monitor.c:283
> #9 0x0000555559378fa2 in qemu_opts_foreach (list=<optimized out>, func=func@entry=0x5555582cfca0 <device_help_func>, opaque=opaque@entry=0x0, errp=errp@entry=0x0) at /home/elmarco/src/qemu/util/qemu-option.c:1171
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1664364
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> hw/core/qdev.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 3769a2bccb..47bddacb4f 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -975,10 +975,13 @@ void object_apply_compat_props(Object *obj)
> if (object_dynamic_cast(qdev_get_machine(), TYPE_MACHINE)) {
> MachineState *m = MACHINE(qdev_get_machine());
> MachineClass *mc = MACHINE_GET_CLASS(m);
> - AccelClass *ac = ACCEL_GET_CLASS(m->accelerator);
>
> - if (ac->compat_props) {
> - object_apply_global_props(obj, ac->compat_props, &error_abort);
> + if (m->accelerator) {
> + AccelClass *ac = ACCEL_GET_CLASS(m->accelerator);
> +
> + if (ac->compat_props) {
> + object_apply_global_props(obj, ac->compat_props, &error_abort);
> + }
> }
> object_apply_global_props(obj, mc->compat_props, &error_abort);
> }
>
Thank you, this addresses my issue and doesn't seem to introduce new ones.
Reviewed-by: Lukáš Doktor <ldoktor@redhat.com>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] qdev: fix -device scsi-hd,help regression
2019-01-09 10:23 [Qemu-devel] [PATCH] qdev: fix -device scsi-hd,help regression Marc-André Lureau
2019-01-09 10:42 ` Cornelia Huck
2019-01-09 16:07 ` Lukáš Doktor
@ 2019-01-09 16:12 ` Igor Mammedov
2 siblings, 0 replies; 4+ messages in thread
From: Igor Mammedov @ 2019-01-09 16:12 UTC (permalink / raw)
To: Marc-André Lureau; +Cc: qemu-devel, cohuck, ehabkost
On Wed, 9 Jan 2019 14:23:11 +0400
Marc-André Lureau <marcandre.lureau@redhat.com> wrote:
> Since commit ea9ce8934, device_post_init() applies globals directly
> from machines and accelerator classes.
>
> There are cases, such as -device scsi-hd,help, where the machine is
> setup but there in no accelerator.
>
> Let's skip accelerator globals in this case.
>
> Fixes SEGV:
> #0 0x0000555558ea04ff in object_get_class (obj=0x0) at /home/elmarco/src/qemu/build/../qom/object.c:857
> #1 0x000055555854c797 in object_apply_compat_props (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:978
> #2 0x000055555854c797 in object_apply_compat_props (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:973
> #3 0x000055555854c959 in device_post_init (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:989
> #4 0x0000555558e9e250 in object_post_init_with_type (ti=<optimized out>, obj=0x616000078980) at /home/elmarco/src/qemu/build/../qom/object.c:365
> #5 0x0000555558e9e250 in object_initialize_with_type (data=0x616000078980, size=616, type=<optimized out>) at /home/elmarco/src/qemu/build/../qom/object.c:425
> #6 0x0000555558e9e571 in object_new_with_type (type=0x613000031900) at /home/elmarco/src/qemu/build/../qom/object.c:588
> #7 0x000055555830c048 in qmp_device_list_properties (typename=typename@entry=0x60200000c2d0 "scsi-hd", errp=errp@entry=0x7fffffffc540) at /home/elmarco/src/qemu/qmp.c:519
> #8 0x00005555582c4027 in qdev_device_help (opts=<optimized out>) at /home/elmarco/src/qemu/qdev-monitor.c:283
> #9 0x0000555559378fa2 in qemu_opts_foreach (list=<optimized out>, func=func@entry=0x5555582cfca0 <device_help_func>, opaque=opaque@entry=0x0, errp=errp@entry=0x0) at /home/elmarco/src/qemu/util/qemu-option.c:1171
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1664364
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> ---
> hw/core/qdev.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 3769a2bccb..47bddacb4f 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -975,10 +975,13 @@ void object_apply_compat_props(Object *obj)
> if (object_dynamic_cast(qdev_get_machine(), TYPE_MACHINE)) {
> MachineState *m = MACHINE(qdev_get_machine());
> MachineClass *mc = MACHINE_GET_CLASS(m);
> - AccelClass *ac = ACCEL_GET_CLASS(m->accelerator);
>
> - if (ac->compat_props) {
> - object_apply_global_props(obj, ac->compat_props, &error_abort);
> + if (m->accelerator) {
> + AccelClass *ac = ACCEL_GET_CLASS(m->accelerator);
> +
> + if (ac->compat_props) {
> + object_apply_global_props(obj, ac->compat_props, &error_abort);
> + }
> }
> object_apply_global_props(obj, mc->compat_props, &error_abort);
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-01-09 16:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-09 10:23 [Qemu-devel] [PATCH] qdev: fix -device scsi-hd,help regression Marc-André Lureau
2019-01-09 10:42 ` Cornelia Huck
2019-01-09 16:07 ` Lukáš Doktor
2019-01-09 16:12 ` 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).