qemu-patch-raspberry4/hw/cpu
Thomas Huth fd31701214 hw/cpu/a15mpcore: Fix introspection problem with the a15mpcore_priv device
There is a memory management problem when introspecting the a15mpcore_priv
device. It can be seen with valgrind when running QEMU like this:

echo "{'execute':'qmp_capabilities'} {'execute':'device-list-properties'," \
 "'arguments':{'typename':'a15mpcore_priv'}}"\
 "{'execute': 'human-monitor-command', " \
 "'arguments': {'command-line': 'info qtree'}}"  | \
 valgrind -q aarch64-softmmu/qemu-system-aarch64 -M none,accel=qtest -qmp stdio
{"QMP": {"version": {"qemu": {"micro": 50, "minor": 12, "major": 2},
 "package": "build-all"}, "capabilities": []}}
{"return": {}}
{"return": [{"name": "num-cpu", "type": "uint32"}, {"name": "num-irq",
 "type": "uint32"}, {"name": "a15mp-priv-container[0]", "type":
  "child<qemu:memory-region>"}]}
==24978== Invalid read of size 8
==24978==    at 0x618EBA: qdev_print (qdev-monitor.c:686)
==24978==    by 0x618EBA: qbus_print (qdev-monitor.c:719)
[...]

Use the new sysbus_init_child_obj() function to make sure that we get
the reference counting of the child objects right.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 1531745974-17187-6-git-send-email-thuth@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-17 13:12:49 +01:00
..
a9mpcore.c explicitly include qom/cpu.h 2016-05-19 16:42:27 +02:00
a15mpcore.c hw/cpu/a15mpcore: Fix introspection problem with the a15mpcore_priv device 2018-07-17 13:12:49 +01:00
arm11mpcore.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
core.c hw: use "qemu/osdep.h" as first #include in source files 2017-12-18 17:07:02 +03:00
Makefile.objs hw/cpu: core.c can be compiled as common object 2017-06-09 12:02:55 +10:00
realview_mpcore.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00