Skip to contentSkip to conversation

hmp: QEMU crash on device_del auto-completion

Qemu-devel Marcel Apfelbaum 3 participants 4 messages Nov 25, 2014 – Nov 26, 2014

lore
Share & tools
lore
#0 lore raw

Hi,

The commits:
- 6a1fa9f5 (monitor: add del completion for peripheral device)
- 66e56b13 (qdev: add qdev_build_hotpluggable_device_list helper)

cause a QEMU crash when trying to use HMP device_del auto-completion.
It can be easily reproduced by:
<qemu-bin> -enable-kvm ~/images/fedora.qcow2 -monitor stdio -device virtio-net-pci,id=vnet
(qemu) device_del /home/mapfelba/git/upstream/qemu/hw/core/qdev.c:941:qdev_build_hotpluggable_device_list: Object 0x7f6ce04e4fe0 is not an instance of type device Aborted (core dumped)

The root cause is qdev_build_hotpluggable_device_list going recursively over all peripherals and their children assuming all are devices. It doesn't work since PCI devices have at least on child which is a memory region (bus master).

Should we try to fix it for 2.2 or simply revert it? Thanks,
Marcel

#1 lore raw
Quoted 12 lines · On Tue, 25 Nov 2014 16:04:19 +0200 Marcel Apfelbaum <[email protected]> wrote:

Hi,

The commits:
- 6a1fa9f5 (monitor: add del completion for peripheral device)
- 66e56b13 (qdev: add qdev_build_hotpluggable_device_list helper)

cause a QEMU crash when trying to use HMP device_del auto-completion.
It can be easily reproduced by:
<qemu-bin> -enable-kvm ~/images/fedora.qcow2 -monitor stdio -device virtio-net-pci,id=vnet
(qemu) device_del /home/mapfelba/git/upstream/qemu/hw/core/qdev.c:941:qdev_build_hotpluggable_device_list: Object 0x7f6ce04e4fe0 is not an instance of type device Aborted (core dumped)

Quoted 5 lines

The root cause is qdev_build_hotpluggable_device_list going recursively over all peripherals and their children assuming all are devices. It doesn't work since PCI devices have at least on child which is a memory region (bus master).

Should we try to fix it for 2.2 or simply revert it?

Do you think you can post a patch in the next few days? If you can then let's try to fix it, otherwise we better revert those commits.

#2 lore raw
Quoted 15 lines · Luiz Capitulino
Quoted 12 lines · On Tue, 25 Nov 2014 16:04:19 +0200 Marcel Apfelbaum <[email protected]> wrote:

Hi,

The commits:
- 6a1fa9f5 (monitor: add del completion for peripheral device)
- 66e56b13 (qdev: add qdev_build_hotpluggable_device_list helper)

cause a QEMU crash when trying to use HMP device_del auto-completion.
It can be easily reproduced by:
<qemu-bin> -enable-kvm ~/images/fedora.qcow2 -monitor stdio -device virtio-net-pci,id=vnet
(qemu) device_del /home/mapfelba/git/upstream/qemu/hw/core/qdev.c:941:qdev_build_hotpluggable_device_list: Object 0x7f6ce04e4fe0 is not an instance of type device Aborted (core dumped)

Quoted 8 lines
Quoted 5 lines

The root cause is qdev_build_hotpluggable_device_list going recursively over all peripherals and their children assuming all are devices. It doesn't work since PCI devices have at least on child which is a memory region (bus master).

Should we try to fix it for 2.2 or simply revert it?

Do you think you can post a patch in the next few days? If you can then let's try to fix it, otherwise we better revert those commits.

I'll try, sure.
Thanks,
Marcel

#3 lore raw
Quoted 20 lines · Marcel Apfelbaum
Quoted 19 lines · Luiz Capitulino
Quoted 16 lines · On Tue, 25 Nov 2014 16:04:19 +0200 Marcel Apfelbaum <[email protected]> wrote:

Hi,

The commits:
- 6a1fa9f5 (monitor: add del completion for peripheral device)
- 66e56b13 (qdev: add qdev_build_hotpluggable_device_list helper)

cause a QEMU crash when trying to use HMP device_del auto-completion.
It can be easily reproduced by:
<qemu-bin> -enable-kvm ~/images/fedora.qcow2 -monitor stdio -device virtio-net-pci,id=vnet
(qemu) device_del /home/mapfelba/git/upstream/qemu/hw/core/qdev.c:941:qdev_build_hotpluggable_device_list: Object 0x7f6ce04e4fe0 is not an instance of type device Aborted (core dumped)

The root cause is qdev_build_hotpluggable_device_list going recursively over all peripherals and their children assuming all are devices. It doesn't work since PCI devices have at least on child which is a memory region (bus master).

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Should we try to fix it for 2.2 or simply revert it?

Do you think you can post a patch in the next few days? If you can then let's try to fix it, otherwise we better revert those commits.

I'll try, sure.

I'm sorry that my patch causes this bug.
Thanks for your work to fix this.

Regards,
Zhu

Quoted 3 lines

Thanks,
Marcel