You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qemu/hw/virtio
Daniel P. Berrangé bff1050a56 hw/virtio: fix crash in processing balloon stats
balloon_stats_get_all will iterate over guest stats upto the max
VIRTIO_BALLOON_S_NR value, calling visit_type_uint64 to populate
the QObject dict. The dict keys are obtained from the static
array balloon_stat_names which is VIRTIO_BALLOON_S_NR in size.

Unfortunately the way that array is declared results in any
unassigned stats getting a NULL name, which will then cause
visit_type_uint64 to trigger an assert in qobject_output_add_obj.

The balloon_stat_names array was fortunately fully populated with
names until recently:

  commit 0d2eeef77a
  Author: Bibo Mao <maobibo@loongson.cn>
  Date:   Mon Oct 28 10:38:09 2024 +0800

    linux-headers: Update to Linux v6.12-rc5

pulled a change to include/standard-headers/linux/virtio_balloon.h
which increased VIRTIO_BALLOON_S_NR by 6, and failed to add the new
names to balloon_stat_names.

This commit fills in the missing names, and uses a static assert to
guarantee that any future changes to VIRTIO_BALLOON_S_NR will cause
a build failure until balloon_stat_names is updated.

This problem was detected by the Cockpit Project's automated
integration tests on QEMU 9.2.0-rc1.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2329448
Fixes: 0d2eeef77a ("linux-headers: Update to Linux v6.12-rc5")
Reported-by: Martin Pitt <mpitt@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20241129135507.699030-2-berrange@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
1 day ago
..
Kconfig device/virtio-nsm: Support for Nitro Secure Module device 1 month ago
cbor-helpers.c device/virtio-nsm: Support for Nitro Secure Module device 1 month ago
meson.build device/virtio-nsm: Support for Nitro Secure Module device 1 month ago
trace-events virtio-iommu: Add trace point on virtio_iommu_detach_endpoint_from_domain 4 months ago
trace.h
vdpa-dev-pci.c
vdpa-dev.c vdpa-dev: Fix the issue of device status not updating when configuration interruption is triggered 8 months ago
vhost-backend.c vhost: Add worker backend callouts 12 months ago
vhost-iova-tree.c
vhost-iova-tree.h
vhost-scsi-pci.c
vhost-shadow-virtqueue.c hw/virtio: freeing leaked memory from vhost_svq_get_buf in vhost_svq_poll 2 months ago
vhost-shadow-virtqueue.h vhost: Expose vhost_svq_available_slots() 1 year ago
vhost-stub.c vhost: Add vhost_get_max_memslots() 1 year ago
vhost-user-base.c hw/virtio: Free vqs after vhost_dev_cleanup() 5 months ago
vhost-user-blk-pci.c
vhost-user-device-pci.c virtio: split into vhost-user-base and vhost-user-device 10 months ago
vhost-user-device.c virtio: split into vhost-user-base and vhost-user-device 10 months ago
vhost-user-fs-pci.c
vhost-user-fs.c vhost,vhost-user: Add VIRTIO_F_IN_ORDER to vhost feature bits 5 months ago
vhost-user-gpio-pci.c
vhost-user-gpio.c hw/virtio: derive vhost-user-gpio from vhost-user-base 10 months ago
vhost-user-i2c-pci.c
vhost-user-i2c.c hw/virtio: derive vhost-user-i2c from vhost-user-base 10 months ago
vhost-user-input-pci.c hw/virtio: derive vhost-user-input from vhost-user-base 10 months ago
vhost-user-input.c hw/virtio: derive vhost-user-input from vhost-user-base 10 months ago
vhost-user-rng-pci.c
vhost-user-rng.c hw/virtio: derive vhost-user-rng from vhost-user-base 10 months ago
vhost-user-scmi-pci.c hw/virtio: Add vhost-user-scmi-pci boilerplate 1 year ago
vhost-user-scmi.c bulk: Access existing variables initialized to &S->F when available 9 months ago
vhost-user-scsi-pci.c
vhost-user-snd-pci.c hw/virtio: add vhost-user-snd and vhost-user-snd-pci devices 10 months ago
vhost-user-snd.c hw/virtio: add vhost-user-snd and vhost-user-snd-pci devices 10 months ago
vhost-user-vsock-pci.c
vhost-user-vsock.c vhost,vhost-user: Add VIRTIO_F_IN_ORDER to vhost feature bits 5 months ago
vhost-user.c vhost-user: fix shared object return values 4 weeks ago
vhost-vdpa.c util/hexdump: Add unit_len and block_len to qemu_hexdump_line 6 months ago
vhost-vsock-common.c vhost-vsock: add VIRTIO_F_RING_PACKED to feature_bits 5 months ago
vhost-vsock-pci.c
vhost-vsock.c hw/virtio/vhost-vsock: Fix missing ERRP_GUARD() for error_prepend() 9 months ago
vhost.c vhost: fail device start if iotlb update fails 1 week ago
virtio-9p-pci.c
virtio-acpi.c license: Update deprecated SPDX tag GPL-2.0+ to GPL-2.0-or-later 3 months ago
virtio-balloon-pci.c
virtio-balloon.c hw/virtio: fix crash in processing balloon stats 1 day ago
virtio-blk-pci.c
virtio-bus.c
virtio-config-io.c
virtio-crypto-pci.c
virtio-crypto.c virtio,pc,pci: features, fixes, cleanups 3 months ago
virtio-hmp-cmds.c
virtio-input-host-pci.c
virtio-input-pci.c
virtio-iommu-pci.c hw/virtio: Free VirtIOIOMMUPCI::vdev.reserved_regions[] on finalize() 1 year ago
virtio-iommu.c virtio-iommu: Add trace point on virtio_iommu_detach_endpoint_from_domain 4 months ago
virtio-md-pci.c hw/mem/memory-device: Remove legacy_align from memory_device_pre_plug() 6 months ago
virtio-md-stubs.c hw/virtio: move stubs out of stubs/ 8 months ago
virtio-mem-pci.c virtio-mem: Expose device memory dynamically via multiple memslots if enabled 1 year ago
virtio-mem-pci.h virtio-md-pci: New parent type for virtio-mem-pci and virtio-pmem-pci 1 year ago
virtio-mem.c migration: Drop migration_is_idle() 1 month ago
virtio-mmio.c hw: Use device_class_set_legacy_reset() instead of opencoding 3 months ago
virtio-net-pci.c Revert "virtio-net: Implement SR-IOV VF" 4 months ago
virtio-nsm-pci.c device/virtio-nsm: Support for Nitro Secure Module device 1 month ago
virtio-nsm.c device/virtio-nsm: Support for Nitro Secure Module device 1 month ago
virtio-pci.c virtio-pci: fix memory_region_find for VirtIOPCIRegion's MR 4 weeks ago
virtio-pmem-pci.c virtio-md-pci: New parent type for virtio-mem-pci and virtio-pmem-pci 1 year ago
virtio-pmem-pci.h virtio-md-pci: New parent type for virtio-mem-pci and virtio-pmem-pci 1 year ago
virtio-pmem.c Revert "hw/virtio/virtio-pmem: Replace impossible check by assertion" 1 year ago
virtio-qmp.c virtio-mem: Add support for suspend+wake-up with plugged memory 2 months ago
virtio-qmp.h qmp: remove virtio_list, search QOM tree instead 1 year ago
virtio-rng-pci.c
virtio-rng.c virtio-rng: block max-bytes=0 4 months ago
virtio-scsi-pci.c
virtio-serial-pci.c
virtio-stub.c
virtio.c virtio-net: Add queues before loading them 1 week ago