* [PATCH-for-6.2] qom/object: Ignore global properties with empty name
@ 2021-11-19 11:32 Philippe Mathieu-Daudé
2021-11-22 11:19 ` Darren Kenny
2021-11-24 8:46 ` Igor Mammedov
0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-11-19 11:32 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Thomas Huth, Daniel P. Berrangé,
Eduardo Habkost, Philippe Mathieu-Daudé
When using -global, properties might have empty name/value.
This fixes this legitimate use case:
$ qemu-system-x86_64 -global driver=isa-fdc
qemu-system-x86_64: ../../devel/qemu/qapi/string-input-visitor.c:394:
string_input_visitor_new: Assertion `str' failed.
Aborted (core dumped)
(gdb) bt
#4 0x0000555555f6b8d5 in string_input_visitor_new (str=0x0) at qapi/string-input-visitor.c:394
#5 0x0000555555dd0f8d in object_property_parse (obj=0x555556f33400, name=0x0, string=0x0, errp=0x7fffffffc9c8) at qom/object.c:1641
#6 0x0000555555dce131 in object_apply_global_props (obj=0x555556f33400, props=0x555556737360, errp=0x555556611760 <error_fatal>) at qom/object.c:411
#7 0x0000555555dc5ee2 in qdev_prop_set_globals (dev=0x555556f33400) at hw/core/qdev-properties.c:790
#8 0x0000555555dc89e8 in device_post_init (obj=0x555556f33400) at hw/core/qdev.c:697
#9 0x0000555555dce02b in object_post_init_with_type (obj=0x555556f33400, ti=0x55555672bd20) at qom/object.c:383
#10 0x0000555555dce059 in object_post_init_with_type (obj=0x555556f33400, ti=0x5555566e9090) at qom/object.c:387
#11 0x0000555555dce059 in object_post_init_with_type (obj=0x555556f33400, ti=0x5555566df730) at qom/object.c:387
#12 0x0000555555dce566 in object_initialize_with_type (obj=0x555556f33400, size=848, type=0x5555566df730) at qom/object.c:519
#13 0x0000555555dcec78 in object_new_with_type (type=0x5555566df730) at qom/object.c:733
#14 0x0000555555dceccf in object_new (typename=0x5555560fcf81 "isa-fdc") at qom/object.c:748
#15 0x0000555555dc75fe in qdev_new (name=0x5555560fcf81 "isa-fdc") at hw/core/qdev.c:153
#16 0x00005555559eec58 in isa_new (name=0x5555560fcf81 "isa-fdc") at hw/isa/isa-bus.c:166
#17 0x0000555555bd3607 in pc_superio_init (isa_bus=0x5555566b42e0, create_fdctrl=true, no_vmport=false) at hw/i386/pc.c:1026
(gdb) fr 6
#6 0x0000555555dce131 in object_apply_global_props (obj=0x555556f33400, props=0x555556737360, errp=0x555556611760 <error_fatal>) at qom/object.c:411
411 if (!object_property_parse(obj, p->property, p->value, &err)) {
(gdb) p *p
$1 = {driver = 0x555556738250 "isa-fdc", property = 0x0, value = 0x0, used = true, optional = false}
Reported-by: Thomas Huth <thuth@redhat.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/604
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
qom/object.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/qom/object.c b/qom/object.c
index 4f0677cca9e..45fa8561df6 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -401,6 +401,9 @@ bool object_apply_global_props(Object *obj, const GPtrArray *props,
GlobalProperty *p = g_ptr_array_index(props, i);
Error *err = NULL;
+ if (!p->property) {
+ continue;
+ }
if (object_dynamic_cast(obj, p->driver) == NULL) {
continue;
}
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH-for-6.2] qom/object: Ignore global properties with empty name
2021-11-19 11:32 [PATCH-for-6.2] qom/object: Ignore global properties with empty name Philippe Mathieu-Daudé
@ 2021-11-22 11:19 ` Darren Kenny
2021-11-24 8:46 ` Igor Mammedov
1 sibling, 0 replies; 3+ messages in thread
From: Darren Kenny @ 2021-11-22 11:19 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Thomas Huth, Daniel P. Berrangé,
Eduardo Habkost, Philippe Mathieu-Daudé
On Friday, 2021-11-19 at 12:32:29 +01, Philippe Mathieu-Daudé wrote:
> When using -global, properties might have empty name/value.
>
> This fixes this legitimate use case:
>
> $ qemu-system-x86_64 -global driver=isa-fdc
> qemu-system-x86_64: ../../devel/qemu/qapi/string-input-visitor.c:394:
> string_input_visitor_new: Assertion `str' failed.
> Aborted (core dumped)
>
> (gdb) bt
> #4 0x0000555555f6b8d5 in string_input_visitor_new (str=0x0) at qapi/string-input-visitor.c:394
> #5 0x0000555555dd0f8d in object_property_parse (obj=0x555556f33400, name=0x0, string=0x0, errp=0x7fffffffc9c8) at qom/object.c:1641
> #6 0x0000555555dce131 in object_apply_global_props (obj=0x555556f33400, props=0x555556737360, errp=0x555556611760 <error_fatal>) at qom/object.c:411
> #7 0x0000555555dc5ee2 in qdev_prop_set_globals (dev=0x555556f33400) at hw/core/qdev-properties.c:790
> #8 0x0000555555dc89e8 in device_post_init (obj=0x555556f33400) at hw/core/qdev.c:697
> #9 0x0000555555dce02b in object_post_init_with_type (obj=0x555556f33400, ti=0x55555672bd20) at qom/object.c:383
> #10 0x0000555555dce059 in object_post_init_with_type (obj=0x555556f33400, ti=0x5555566e9090) at qom/object.c:387
> #11 0x0000555555dce059 in object_post_init_with_type (obj=0x555556f33400, ti=0x5555566df730) at qom/object.c:387
> #12 0x0000555555dce566 in object_initialize_with_type (obj=0x555556f33400, size=848, type=0x5555566df730) at qom/object.c:519
> #13 0x0000555555dcec78 in object_new_with_type (type=0x5555566df730) at qom/object.c:733
> #14 0x0000555555dceccf in object_new (typename=0x5555560fcf81 "isa-fdc") at qom/object.c:748
> #15 0x0000555555dc75fe in qdev_new (name=0x5555560fcf81 "isa-fdc") at hw/core/qdev.c:153
> #16 0x00005555559eec58 in isa_new (name=0x5555560fcf81 "isa-fdc") at hw/isa/isa-bus.c:166
> #17 0x0000555555bd3607 in pc_superio_init (isa_bus=0x5555566b42e0, create_fdctrl=true, no_vmport=false) at hw/i386/pc.c:1026
> (gdb) fr 6
> #6 0x0000555555dce131 in object_apply_global_props (obj=0x555556f33400, props=0x555556737360, errp=0x555556611760 <error_fatal>) at qom/object.c:411
> 411 if (!object_property_parse(obj, p->property, p->value, &err)) {
> (gdb) p *p
> $1 = {driver = 0x555556738250 "isa-fdc", property = 0x0, value = 0x0, used = true, optional = false}
>
> Reported-by: Thomas Huth <thuth@redhat.com>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/604
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
> ---
> qom/object.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/qom/object.c b/qom/object.c
> index 4f0677cca9e..45fa8561df6 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -401,6 +401,9 @@ bool object_apply_global_props(Object *obj, const GPtrArray *props,
> GlobalProperty *p = g_ptr_array_index(props, i);
> Error *err = NULL;
>
> + if (!p->property) {
> + continue;
> + }
> if (object_dynamic_cast(obj, p->driver) == NULL) {
> continue;
> }
> --
> 2.31.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH-for-6.2] qom/object: Ignore global properties with empty name
2021-11-19 11:32 [PATCH-for-6.2] qom/object: Ignore global properties with empty name Philippe Mathieu-Daudé
2021-11-22 11:19 ` Darren Kenny
@ 2021-11-24 8:46 ` Igor Mammedov
1 sibling, 0 replies; 3+ messages in thread
From: Igor Mammedov @ 2021-11-24 8:46 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Paolo Bonzini, Thomas Huth, Daniel P. Berrangé, qemu-devel,
Eduardo Habkost
On Fri, 19 Nov 2021 12:32:29 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> When using -global, properties might have empty name/value.
>
> This fixes this legitimate use case:
>
> $ qemu-system-x86_64 -global driver=isa-fdc
> qemu-system-x86_64: ../../devel/qemu/qapi/string-input-visitor.c:394:
> string_input_visitor_new: Assertion `str' failed.
> Aborted (core dumped)
why ignore instead of printing error message and exiting?
it never worked before, and I don't see a reason to let QEMU startup fine
with nonsense CLI.
>
> (gdb) bt
> #4 0x0000555555f6b8d5 in string_input_visitor_new (str=0x0) at qapi/string-input-visitor.c:394
> #5 0x0000555555dd0f8d in object_property_parse (obj=0x555556f33400, name=0x0, string=0x0, errp=0x7fffffffc9c8) at qom/object.c:1641
> #6 0x0000555555dce131 in object_apply_global_props (obj=0x555556f33400, props=0x555556737360, errp=0x555556611760 <error_fatal>) at qom/object.c:411
> #7 0x0000555555dc5ee2 in qdev_prop_set_globals (dev=0x555556f33400) at hw/core/qdev-properties.c:790
> #8 0x0000555555dc89e8 in device_post_init (obj=0x555556f33400) at hw/core/qdev.c:697
> #9 0x0000555555dce02b in object_post_init_with_type (obj=0x555556f33400, ti=0x55555672bd20) at qom/object.c:383
> #10 0x0000555555dce059 in object_post_init_with_type (obj=0x555556f33400, ti=0x5555566e9090) at qom/object.c:387
> #11 0x0000555555dce059 in object_post_init_with_type (obj=0x555556f33400, ti=0x5555566df730) at qom/object.c:387
> #12 0x0000555555dce566 in object_initialize_with_type (obj=0x555556f33400, size=848, type=0x5555566df730) at qom/object.c:519
> #13 0x0000555555dcec78 in object_new_with_type (type=0x5555566df730) at qom/object.c:733
> #14 0x0000555555dceccf in object_new (typename=0x5555560fcf81 "isa-fdc") at qom/object.c:748
> #15 0x0000555555dc75fe in qdev_new (name=0x5555560fcf81 "isa-fdc") at hw/core/qdev.c:153
> #16 0x00005555559eec58 in isa_new (name=0x5555560fcf81 "isa-fdc") at hw/isa/isa-bus.c:166
> #17 0x0000555555bd3607 in pc_superio_init (isa_bus=0x5555566b42e0, create_fdctrl=true, no_vmport=false) at hw/i386/pc.c:1026
> (gdb) fr 6
> #6 0x0000555555dce131 in object_apply_global_props (obj=0x555556f33400, props=0x555556737360, errp=0x555556611760 <error_fatal>) at qom/object.c:411
> 411 if (!object_property_parse(obj, p->property, p->value, &err)) {
> (gdb) p *p
> $1 = {driver = 0x555556738250 "isa-fdc", property = 0x0, value = 0x0, used = true, optional = false}
>
> Reported-by: Thomas Huth <thuth@redhat.com>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/604
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> qom/object.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/qom/object.c b/qom/object.c
> index 4f0677cca9e..45fa8561df6 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -401,6 +401,9 @@ bool object_apply_global_props(Object *obj, const GPtrArray *props,
> GlobalProperty *p = g_ptr_array_index(props, i);
> Error *err = NULL;
>
> + if (!p->property) {
> + continue;
> + }
> if (object_dynamic_cast(obj, p->driver) == NULL) {
> continue;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-24 8:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-19 11:32 [PATCH-for-6.2] qom/object: Ignore global properties with empty name Philippe Mathieu-Daudé
2021-11-22 11:19 ` Darren Kenny
2021-11-24 8:46 ` 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).