All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL 00/23] Fixes for 11.1-rc2
@ 2026-07-27 11:51 Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 01/23] hw/display/virtio-gpu: Remove the bytes_pp field Marc-André Lureau
                   ` (22 more replies)
  0 siblings, 23 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi

The following changes since commit 6333226c2abb72f31648c251624c56e70993d625:

  Merge tag 'pull-9p-20260725' of https://github.com/cschoenebeck/qemu into staging (2026-07-26 08:30:07 -0400)

are available in the Git repository at:

  https://gitlab.com/marcandre.lureau/qemu.git tags/fix-pr-v1

for you to fetch changes up to 0e83d6894534cfe4cf071381ea8466cc689e044e:

  migration/rdma: annotate and simplify wait_comp_channel() (2026-07-27 15:51:03 +0400)

----------------------------------------------------------------
Fixes for 11.1-rc2

To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

----------------------------------------------------------------
Akihiko Odaki (5):
      hw/display/virtio-gpu: Remove the bytes_pp field
      hw/display/virtio-gpu: Fix empty blob discrimination
      hw/display/virtio-gpu: Initialize blob mapping for ATTACH_BACKING
      hw/display/virtio-gpu: Avoid leaking migration blocker
      hw/display/virtio-gpu: Block Rutabaga migration

Haotian Jiang (2):
      hw/display/qxl: unregister vm_change_state handler and BHs
      virtio-gpu: fix NULL deref in rutabaga set_scanout

Marc-André Lureau (16):
      hw/display/vhost-user-gpu: validate message payload sizes
      ui/vnc: remove redundant rows computation
      net/colo: fix g_hash_table_destroy assertion on uninitialized filter
      target/i386/sev: fix MemoryRegion reference leaks in gpa2hva callers
      docs/hyperv: fix misleading hv-crash shutdown description
      hw/display/virtio-gpu-rutabaga: zero-init capset info response
      hw/cxl: fix invalid free on early return
      hw/hexagon: fix machine->fdt leak in qom-test
      block/blkio: fix compiler false-positive warning
      monitor: annotate monitor_qmp_dispatcher_pop_any() as coroutine
      migration: fix qemu_get_counted_string annotation
      io: add missing coroutine annotation
      block: add missing coroutine annotation
      qcow2: remove invalid qcow2_check_refcounts calls
      hw/9pfs: annotate V9fsTransport callbacks as coroutine_fn
      migration/rdma: annotate and simplify wait_comp_channel()

 docs/system/i386/hyperv.rst      | 12 ++++++----
 hw/9pfs/9p.h                     | 26 ++++++++++++---------
 hw/display/qxl.h                 |  1 +
 include/hw/virtio/virtio-gpu.h   |  1 -
 include/io/channel.h             |  4 ++--
 include/system/memory.h          |  2 ++
 block/blkio.c                    |  5 ++--
 block/commit.c                   |  5 ++--
 block/qcow2-snapshot.c           | 18 ---------------
 hw/9pfs/9p.c                     | 31 +++++++++++++++----------
 hw/9pfs/virtio-9p-device.c       | 24 +++++++++++---------
 hw/9pfs/xen-9p-backend.c         | 34 ++++++++++++++--------------
 hw/cxl/cxl-host.c                |  2 +-
 hw/display/qxl.c                 | 16 ++++++++++++-
 hw/display/vhost-user-gpu.c      | 38 +++++++++++++++++++++++++++++++
 hw/display/virtio-gpu-base.c     | 37 +++++++++++++-----------------
 hw/display/virtio-gpu-rutabaga.c | 21 ++++++++++++++---
 hw/display/virtio-gpu.c          | 49 ++++++++++++++++++++++++----------------
 hw/hexagon/virt.c                |  9 +-------
 io/channel.c                     |  5 ++--
 migration/qemu-file.c            |  2 +-
 migration/rdma.c                 | 12 ++++------
 monitor/qmp.c                    |  3 ++-
 net/filter-rewriter.c            |  2 +-
 target/i386/sev.c                |  4 ++--
 ui/vnc.c                         |  1 -
 26 files changed, 214 insertions(+), 150 deletions(-)



^ permalink raw reply	[flat|nested] 24+ messages in thread

* [GIT PULL 01/23] hw/display/virtio-gpu: Remove the bytes_pp field
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 02/23] hw/display/vhost-user-gpu: validate message payload sizes Marc-André Lureau
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel
  Cc: Stefan Hajnoczi, Alex Bennée, Akihiko Odaki, Dmitry Osipenko,
	Michael S. Tsirkin

From: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>

virtio_gpu_do_set_scanout() validates the stride field of struct
virtio_gpu_framebuffer against the bytes_pp field, but bytes_pp in the
migration stream may be inconsistent with the format field, which
pixman_image_create_bits() uses when it accesses the framebuffer.
That validation is therefore incomplete.

To avoid the trouble of synchronizing the two fields, remove bytes_pp,
and always derive its value from format. Removing bytes_pp is safe
because no released version of QEMU uses its migrated value.

Fixes: 7b5574225429 ("hw/display: check frame buffer can hold blob")
Cc: qemu-stable@nongnu.org
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
[ Marc-André - fix rebase conflict ]
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Message-ID: <20260719-bpp-v1-1-9b91946d6cf3@rsg.ci.i.u-tokyo.ac.jp>
---
 include/hw/virtio/virtio-gpu.h |  1 -
 hw/display/virtio-gpu.c        | 27 +++++++++++++++++----------
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index b9bad27c97a8..2f60c72078b3 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -66,7 +66,6 @@ struct virtio_gpu_simple_resource {
 
 struct virtio_gpu_framebuffer {
     pixman_format_code_t format;
-    uint32_t bytes_pp;
     uint32_t width, height;
     uint32_t stride;
     uint32_t offset;
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 718ba3039290..eac039c3c366 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -617,6 +617,11 @@ void virtio_gpu_update_scanout(VirtIOGPU *g,
     scanout->fb = *fb;
 }
 
+static uint32_t virtio_gpu_format_bytes_pp(pixman_format_code_t format)
+{
+    return DIV_ROUND_UP(PIXMAN_FORMAT_BPP(format), 8);
+}
+
 static bool virtio_gpu_do_set_scanout(VirtIOGPU *g,
                                       uint32_t scanout_id,
                                       struct virtio_gpu_framebuffer *fb,
@@ -625,6 +630,7 @@ static bool virtio_gpu_do_set_scanout(VirtIOGPU *g,
                                       uint32_t *error)
 {
     struct virtio_gpu_scanout *scanout;
+    uint32_t bytes_pp = virtio_gpu_format_bytes_pp(fb->format);
     uint8_t *data;
 
     scanout = &g->parent_obj.scanout[scanout_id];
@@ -646,10 +652,10 @@ static bool virtio_gpu_do_set_scanout(VirtIOGPU *g,
         return false;
     }
 
-    if (fb->stride < (uint64_t)fb->width * fb->bytes_pp) {
+    if (fb->stride < (uint64_t)fb->width * bytes_pp) {
         qemu_log_mask(LOG_GUEST_ERROR,
                       "%s: stride %u too small for width %u at %u bpp\n",
-                      __func__, fb->stride, fb->width, fb->bytes_pp);
+                      __func__, fb->stride, fb->width, bytes_pp);
         *error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER;
         return false;
     }
@@ -720,6 +726,7 @@ static void virtio_gpu_set_scanout(VirtIOGPU *g,
     struct virtio_gpu_simple_resource *res;
     struct virtio_gpu_framebuffer fb = { 0 };
     struct virtio_gpu_set_scanout ss;
+    uint32_t bytes_pp;
 
     VIRTIO_GPU_FILL_CMD(ss);
     virtio_gpu_bswap_32(&ss, sizeof(ss));
@@ -745,11 +752,11 @@ static void virtio_gpu_set_scanout(VirtIOGPU *g,
     }
 
     fb.format = pixman_image_get_format(res->image);
-    fb.bytes_pp = DIV_ROUND_UP(PIXMAN_FORMAT_BPP(fb.format), 8);
+    bytes_pp = virtio_gpu_format_bytes_pp(fb.format);
     fb.width  = pixman_image_get_width(res->image);
     fb.height = pixman_image_get_height(res->image);
     fb.stride = pixman_image_get_stride(res->image);
-    fb.offset = ss.r.x * fb.bytes_pp + ss.r.y * fb.stride;
+    fb.offset = ss.r.x * bytes_pp + ss.r.y * fb.stride;
 
     virtio_gpu_do_set_scanout(g, ss.scanout_id,
                               &fb, res, &ss.r, &cmd->error);
@@ -760,6 +767,7 @@ bool virtio_gpu_scanout_blob_to_fb(struct virtio_gpu_framebuffer *fb,
                                    uint64_t blob_size)
 {
     uint64_t fbend;
+    uint32_t bytes_pp;
 
     fb->format = virtio_gpu_get_pixman_format(ss->format);
     if (!fb->format) {
@@ -769,15 +777,15 @@ bool virtio_gpu_scanout_blob_to_fb(struct virtio_gpu_framebuffer *fb,
         return false;
     }
 
-    fb->bytes_pp = DIV_ROUND_UP(PIXMAN_FORMAT_BPP(fb->format), 8);
+    bytes_pp = virtio_gpu_format_bytes_pp(fb->format);
     fb->width = ss->width;
     fb->height = ss->height;
     fb->stride = ss->strides[0];
 
-    if (fb->stride < (uint64_t)fb->width * fb->bytes_pp) {
+    if (fb->stride < (uint64_t)fb->width * bytes_pp) {
         qemu_log_mask(LOG_GUEST_ERROR,
                       "%s: stride %u too small for width %u at %u bpp\n",
-                      __func__, fb->stride, fb->width, fb->bytes_pp);
+                      __func__, fb->stride, fb->width, bytes_pp);
         return false;
     }
 
@@ -788,7 +796,7 @@ bool virtio_gpu_scanout_blob_to_fb(struct virtio_gpu_framebuffer *fb,
         return false;
     }
 
-    fb->offset = ss->offsets[0] + ss->r.x * fb->bytes_pp + ss->r.y * fb->stride;
+    fb->offset = ss->offsets[0] + ss->r.x * bytes_pp + ss->r.y * fb->stride;
 
     fbend = fb->offset;
     fbend += (uint64_t) fb->stride * ss->r.height;
@@ -1238,8 +1246,7 @@ static const VMStateDescription vmstate_virtio_gpu_scanout = {
         VMSTATE_UINT32(cursor.pos.y, struct virtio_gpu_scanout),
         VMSTATE_UINT32_TEST(fb.format, struct virtio_gpu_scanout,
                             scanout_vmstate_after_v2),
-        VMSTATE_UINT32_TEST(fb.bytes_pp, struct virtio_gpu_scanout,
-                            scanout_vmstate_after_v2),
+        VMSTATE_UNUSED_TEST(scanout_vmstate_after_v2, 4),
         VMSTATE_UINT32_TEST(fb.width, struct virtio_gpu_scanout,
                             scanout_vmstate_after_v2),
         VMSTATE_UINT32_TEST(fb.height, struct virtio_gpu_scanout,

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 02/23] hw/display/vhost-user-gpu: validate message payload sizes
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 01/23] hw/display/virtio-gpu: Remove the bytes_pp field Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 03/23] ui/vnc: remove redundant rows computation Marc-André Lureau
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel
  Cc: Stefan Hajnoczi, Michael S. Tsirkin, Stefano Garzarella,
	Marc-André Lureau

A malicious or buggy vhost-user-gpu backend can send messages with
undersized payloads, leading to out-of-bounds reads when the handler
accesses struct fields beyond the allocated buffer. However,
vhost-user-gpu is considered trusted by QEMU by design (it has access to
shared memory etc).

Add a centralized minimum payload size check in vhost_user_gpu_chr_read()
that rejects messages before dispatch, and a per-pixel bounds check in
the VHOST_USER_GPU_UPDATE handler to ensure the variable-length data
covers the declared width x height.

Fixes: 267f66465 ("hw/display: add vhost-user-vga & gpu-pci")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3866
Reported-by: Feifan Qian <bea1e@proton.me>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/vhost-user-gpu.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c
index 57360898ca0d..cd684d63639e 100644
--- a/hw/display/vhost-user-gpu.c
+++ b/hw/display/vhost-user-gpu.c
@@ -119,6 +119,31 @@ static VhostUserGpuMsg m __attribute__ ((unused));
 
 static void vhost_user_gpu_update_blocked(VhostUserGPU *g, bool blocked);
 
+static size_t
+vhost_user_gpu_min_payload_size(VhostUserGpuRequest request)
+{
+    switch (request) {
+    case VHOST_USER_GPU_CURSOR_POS:
+    case VHOST_USER_GPU_CURSOR_POS_HIDE:
+        return sizeof(VhostUserGpuCursorPos);
+    case VHOST_USER_GPU_CURSOR_UPDATE:
+        return sizeof(VhostUserGpuCursorUpdate);
+    case VHOST_USER_GPU_GET_EDID:
+        return sizeof(VhostUserGpuEdidRequest);
+    case VHOST_USER_GPU_SCANOUT:
+        return sizeof(VhostUserGpuScanout);
+    case VHOST_USER_GPU_DMABUF_SCANOUT:
+        return sizeof(VhostUserGpuDMABUFScanout);
+    case VHOST_USER_GPU_DMABUF_SCANOUT2:
+        return sizeof(VhostUserGpuDMABUFScanout2);
+    case VHOST_USER_GPU_DMABUF_UPDATE:
+    case VHOST_USER_GPU_UPDATE:
+        return sizeof(VhostUserGpuUpdate);
+    default:
+        return 0;
+    }
+}
+
 static void
 vhost_user_gpu_handle_cursor(VhostUserGPU *g, VhostUserGpuMsg *msg)
 {
@@ -322,6 +347,14 @@ vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUserGpuMsg *msg)
         if (m->scanout_id >= g->parent_obj.conf.max_outputs) {
             break;
         }
+
+        if ((uint64_t)m->width * m->height >
+            (msg->size - sizeof(VhostUserGpuUpdate)) / sizeof(uint32_t)) {
+            error_report("vhost-user-gpu: update payload too small"
+                         " for %ux%u", m->width, m->height);
+            break;
+        }
+
         s = &g->parent_obj.scanout[m->scanout_id];
         con = s->con;
         pixman_image_t *image =
@@ -396,6 +429,11 @@ vhost_user_gpu_chr_read(void *opaque)
     msg->flags = flags;
     msg->size = size;
 
+    if (size < vhost_user_gpu_min_payload_size(request)) {
+        error_report("vhost-user-gpu: message %d payload too small", request);
+        goto end;
+    }
+
     if (request == VHOST_USER_GPU_CURSOR_UPDATE ||
         request == VHOST_USER_GPU_CURSOR_POS ||
         request == VHOST_USER_GPU_CURSOR_POS_HIDE) {

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 03/23] ui/vnc: remove redundant rows computation
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 01/23] hw/display/virtio-gpu: Remove the bytes_pp field Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 02/23] hw/display/vhost-user-gpu: validate message payload sizes Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 04/23] hw/display/qxl: unregister vm_change_state handler and BHs Marc-André Lureau
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi, Marc-André Lureau

"rows" was already computed in an earlier commit 3543c2b855 ("ui/vnc:
fix OOB write in vnc_refresh_lossy_rect").

Fixes: e650e4fe0f ("ui/vnc: fix out-of-bounds write in lossy refresh dirty marking")
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/vnc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index 24aa40f7308e..656768f9c998 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3016,7 +3016,6 @@ static int vnc_refresh_lossy_rect(VncDisplay *vd, int x, int y,
 
     y = QEMU_ALIGN_DOWN(y, VNC_STAT_RECT);
     x = QEMU_ALIGN_DOWN(x, VNC_STAT_RECT);
-    rows = MIN(VNC_STAT_RECT, height - y);
 
     rows = MIN(VNC_STAT_RECT, height - y);
     if (rows <= 0) {

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 04/23] hw/display/qxl: unregister vm_change_state handler and BHs
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (2 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 03/23] ui/vnc: remove redundant rows computation Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 05/23] net/colo: fix g_hash_table_destroy assertion on uninitialized filter Marc-André Lureau
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi

From: Haotian Jiang <sundayjiang@tencent.com>

qxl_realize_common() registers a vm_change_state handler via
qemu_add_vm_change_state_handler() and creates three bottom halves
(update_irq, update_area_bh, cursor_bh), but none are ever cleaned up.
The return value of qemu_add_vm_change_state_handler() is discarded, so
the handler is never removed from the global list, and there is no
PCIDeviceClass.exit callback to delete the BHs.

When a secondary QXL device (hotpluggable by default) is hot-unplugged
via device_del, the PCIQXLDevice memory is freed but the vm_state
handler and BH entries remain with dangling opaque pointers. On the
next VM state change (stop/cont/migrate) or BH dispatch, the callback
dereferences freed memory, causing a use-after-free.

Fix this by storing the VMChangeStateEntry returned by
qemu_add_vm_change_state_handler() and adding a qxl_exit() callback
that deletes the vm_state handler, all three BHs, and the
guest_surfaces.cmds allocation before the device memory is freed.

Fixes: a19cbfb34642 ("spice: add qxl device")
Fixes: CVE-2026-63322
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3607
Signed-off-by: Haotian Jiang <jianghaotian.sunday@gmail.com>
Cc: qemu-stable@nongnu.org
[ Marc-André - tweak commit message, add TODO ]
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260720024855.3757499-1-jianghaotian.sunday@gmail.com>
---
 hw/display/qxl.h |  1 +
 hw/display/qxl.c | 16 +++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/hw/display/qxl.h b/hw/display/qxl.h
index ad8a9128785e..48d664f77736 100644
--- a/hw/display/qxl.h
+++ b/hw/display/qxl.h
@@ -83,6 +83,7 @@ struct PCIQXLDevice {
 
     /* thread signaling */
     QEMUBH             *update_irq;
+    VMChangeStateEntry *vmstate_handler;
 
     /* ram pci bar */
     QXLRam             *ram;
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 3df796175c29..b7d871b9ee33 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -2203,7 +2203,8 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
         error_report_err(err);
     }
 
-    qemu_add_vm_change_state_handler(qxl_vm_change_state_handler, qxl);
+    qxl->vmstate_handler =
+        qemu_add_vm_change_state_handler(qxl_vm_change_state_handler, qxl);
 
     qxl->update_irq = qemu_bh_new_guarded(qxl_update_irq_bh, qxl,
                                           &DEVICE(qxl)->mem_reentrancy_guard);
@@ -2475,6 +2476,18 @@ static const Property qxl_properties[] = {
         DEFINE_PROP_UINT32("yres", PCIQXLDevice, yres, 0),
 };
 
+static void qxl_exit(PCIDevice *dev)
+{
+    PCIQXLDevice *qxl = PCI_QXL(dev);
+
+    /* TODO: complete cleanup, error paths etc */
+    g_clear_pointer(&qxl->vmstate_handler, qemu_del_vm_change_state_handler);
+    g_clear_pointer(&qxl->update_irq, qemu_bh_delete);
+    g_clear_pointer(&qxl->update_area_bh, qemu_bh_delete);
+    g_clear_pointer(&qxl->ssd.cursor_bh, qemu_bh_delete);
+    g_clear_pointer(&qxl->guest_surfaces.cmds, g_free);
+}
+
 static void qxl_pci_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -2482,6 +2495,7 @@ static void qxl_pci_class_init(ObjectClass *klass, const void *data)
 
     k->vendor_id = REDHAT_PCI_VENDOR_ID;
     k->device_id = QXL_DEVICE_ID_STABLE;
+    k->exit = qxl_exit;
     set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
     device_class_set_legacy_reset(dc, qxl_reset_handler);
     dc->vmsd = &qxl_vmstate;

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 05/23] net/colo: fix g_hash_table_destroy assertion on uninitialized filter
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (3 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 04/23] hw/display/qxl: unregister vm_change_state handler and BHs Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 06/23] target/i386/sev: fix MemoryRegion reference leaks in gpa2hva callers Marc-André Lureau
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi, Zhang Chen, Li Zhijian, Jason Wang

colo_rewriter_cleanup() unconditionally destroys connection_track_table,
but the table is only allocated in colo_rewriter_setup(). When the
filter-rewriter object is finalized without having been set up (e.g.
during qom-test property enumeration), the pointer is NULL and
g_hash_table_destroy() fires an assertion.

Use g_clear_pointer() to skip the destroy when the table was never
initialized.

Signed-off-by: Marc-Andre Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Zhang Chen <zhangckid@gmail.com>
Message-ID: <20260709111315.1108185-1-marcandre.lureau@redhat.com>
---
 net/filter-rewriter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c
index cdf85aa5eed3..c85d180eb963 100644
--- a/net/filter-rewriter.c
+++ b/net/filter-rewriter.c
@@ -373,7 +373,7 @@ static void colo_rewriter_cleanup(NetFilterState *nf)
         g_free(s->incoming_queue);
     }
 
-    g_hash_table_destroy(s->connection_track_table);
+    g_clear_pointer(&s->connection_track_table, g_hash_table_destroy);
 }
 
 static void colo_rewriter_setup(NetFilterState *nf, Error **errp)

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 06/23] target/i386/sev: fix MemoryRegion reference leaks in gpa2hva callers
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (4 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 05/23] net/colo: fix g_hash_table_destroy assertion on uninitialized filter Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 07/23] virtio-gpu: fix NULL deref in rutabaga set_scanout Marc-André Lureau
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel
  Cc: Stefan Hajnoczi, Paolo Bonzini, Peter Xu,
	Philippe Mathieu-Daudé, Zhao Liu, Marcelo Tosatti, kvm

gpa2hva() returns a referenced MemoryRegion via its p_mr out-parameter
(inherited from memory_region_find()), but both SEV callers were failing
to release it.

Fixes: c7f7e6970d3b ("sev: add sev-inject-launch-secret")
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260521145451.1831984-1-marcandre.lureau@redhat.com>
---
 include/system/memory.h | 2 ++
 target/i386/sev.c       | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/system/memory.h b/include/system/memory.h
index 47a0e06fbf8a..2192fc9bdc5b 100644
--- a/include/system/memory.h
+++ b/include/system/memory.h
@@ -1085,6 +1085,8 @@ void memory_region_ref(MemoryRegion *mr);
  */
 void memory_region_unref(MemoryRegion *mr);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(MemoryRegion, memory_region_unref)
+
 /**
  * memory_region_init_io: Initialize an I/O memory region.
  *
diff --git a/target/i386/sev.c b/target/i386/sev.c
index debe6344ab4d..d7dcefc8ecf5 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -1569,7 +1569,7 @@ snp_populate_metadata_pages(SevSnpGuestState *sev_snp,
     OvmfSevMetadataDesc *desc;
     int type, ret, i;
     void *hva;
-    MemoryRegion *mr = NULL;
+    g_autoptr(MemoryRegion) mr = NULL;
 
     for (i = 0; i < metadata->num_desc; i++) {
         desc = &metadata->descs[i];
@@ -2063,7 +2063,7 @@ int sev_inject_launch_secret(const char *packet_hdr, const char *secret,
     int error, ret = 1;
     void *hva;
     gsize hdr_sz = 0, data_sz = 0;
-    MemoryRegion *mr = NULL;
+    g_autoptr(MemoryRegion) mr = NULL;
     SevCommonState *sev_common = SEV_COMMON(MACHINE(qdev_get_machine())->cgs);
 
     if (!sev_common) {

-- 
2.55.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 07/23] virtio-gpu: fix NULL deref in rutabaga set_scanout
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (5 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 06/23] target/i386/sev: fix MemoryRegion reference leaks in gpa2hva callers Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 08/23] docs/hyperv: fix misleading hv-crash shutdown description Marc-André Lureau
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel
  Cc: Stefan Hajnoczi, Alex Bennée, Akihiko Odaki, Dmitry Osipenko,
	Michael S. Tsirkin

From: Haotian Jiang <jianghaotian.sunday@gmail.com>

rutabaga_cmd_set_scanout() checks scanout_id < VIRTIO_GPU_MAX_SCANOUTS
(16), but does not check scanout_id < conf.max_outputs like the base
class (virtio-gpu.c) and virgl backend (virtio-gpu-virgl.c) do.

With the default max_outputs=1, virtio_gpu_base_device_realize only
initializes scanout[0].con. A guest submitting SET_SCANOUT with
scanout_id >= 1 takes the con=NULL path, and
qemu_console_set_surface(NULL, NULL) dereferences con->ds, crashing
QEMU.

Replace VIRTIO_GPU_MAX_SCANOUTS with vb->conf.max_outputs in the
CHECK, since realization already ensures max_outputs <=
VIRTIO_GPU_MAX_SCANOUTS.

Fixes: 1dcc6adbc168 ("gfxstream + rutabaga: add initial support for gfxstream")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3897
Cc: qemu-stable@nongnu.org
Message-ID: <20260720071556.106003-1-jianghaotian.sunday@gmail.com>
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Haotian Jiang <jianghaotian.sunday@gmail.com>
---
 hw/display/virtio-gpu-rutabaga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/virtio-gpu-rutabaga.c b/hw/display/virtio-gpu-rutabaga.c
index 4d7d7b245929..6af5c2514d23 100644
--- a/hw/display/virtio-gpu-rutabaga.c
+++ b/hw/display/virtio-gpu-rutabaga.c
@@ -302,7 +302,7 @@ rutabaga_cmd_set_scanout(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd)
     trace_virtio_gpu_cmd_set_scanout(ss.scanout_id, ss.resource_id,
                                      ss.r.width, ss.r.height, ss.r.x, ss.r.y);
 
-    CHECK(ss.scanout_id < VIRTIO_GPU_MAX_SCANOUTS, cmd);
+    CHECK(ss.scanout_id < vb->conf.max_outputs, cmd);
     scanout = &vb->scanout[ss.scanout_id];
 
     if (ss.resource_id == 0) {

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 08/23] docs/hyperv: fix misleading hv-crash shutdown description
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (6 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 07/23] virtio-gpu: fix NULL deref in rutabaga set_scanout Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 09/23] hw/display/virtio-gpu: Fix empty blob discrimination Marc-André Lureau
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi, Paolo Bonzini, Zhao Liu, Pierrick Bouvier

The documentation stated that writing to HV_X64_MSR_CRASH_CTL
unconditionally causes the guest to shutdown. In reality, it triggers
qemu_system_guest_panicked() via KVM_SYSTEM_EVENT_CRASH and the
resulting action depends on the generic panic action policy
(-action panic=...), which defaults to shutdown.

Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260701122135.3168729-1-marcandre.lureau@redhat.com>
---
 docs/system/i386/hyperv.rst | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/docs/system/i386/hyperv.rst b/docs/system/i386/hyperv.rst
index 1c1de77feb65..e1babffb0f99 100644
--- a/docs/system/i386/hyperv.rst
+++ b/docs/system/i386/hyperv.rst
@@ -71,8 +71,11 @@ Existing enlightenments
   by the guest when it crashes, HV_X64_MSR_CRASH_P0..HV_X64_MSR_CRASH_P5 MSRs
   contain additional crash information. This information is outputted in QEMU log
   and through QAPI.
-  Note: unlike under genuine Hyper-V, write to HV_X64_MSR_CRASH_CTL causes guest
-  to shutdown. This effectively blocks crash dump generation by Windows.
+  Note: unlike under genuine Hyper-V, write to HV_X64_MSR_CRASH_CTL triggers
+  ``qemu_system_guest_panicked()`` via ``KVM_SYSTEM_EVENT_CRASH`` and the
+  resulting action depends on the ``-action panic=...`` policy (default:
+  ``shutdown``). With the default action, this effectively blocks crash dump
+  generation by Windows.
 
 ``hv-time``
   Enables two Hyper-V-specific clocksources available to the guest: MSR-based
@@ -304,8 +307,9 @@ currently implemented Hyper-V enlightenments with the following exceptions:
   ``hv-version-id-snumber`` can be left unchanged, guests are not supposed to
   behave differently when different Hyper-V version is presented to them.
 - ``hv-crash`` must only be enabled if the crash information is consumed via
-  QAPI by higher levels of the virtualization stack. Enabling this feature
-  effectively prevents Windows from creating dumps upon crashes.
+  QAPI by higher levels of the virtualization stack. With the default
+  ``-action panic=shutdown`` policy, enabling this feature effectively
+  prevents Windows from creating dumps upon crashes.
 - ``hv-reenlightenment`` can only be used on hardware which supports TSC
   scaling or when guest migration is not needed.
 - ``hv-spinlocks`` should be set to e.g. 0xfff when host CPUs are overcommited

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 09/23] hw/display/virtio-gpu: Fix empty blob discrimination
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (7 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 08/23] docs/hyperv: fix misleading hv-crash shutdown description Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 10/23] hw/display/virtio-gpu: Initialize blob mapping for ATTACH_BACKING Marc-André Lureau
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel
  Cc: Stefan Hajnoczi, Michael S. Tsirkin, Alex Bennée,
	Akihiko Odaki, Dmitry Osipenko

From: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>

Discriminating blobs by checking whether blob_size is nonzero fails for
empty blobs. Identify 2D resources by their non-NULL image instead.

Fixes: bdd53f739273 ("virtio-gpu: Update cursor data using blob")
Fixes: f66767f75c9c ("virtio-gpu: add virtio-gpu/blob vmstate subsection")
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260725-image-v1-1-4698a805afde@rsg.ci.i.u-tokyo.ac.jp>
---
 hw/display/virtio-gpu.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index eac039c3c366..add60926f366 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -56,18 +56,18 @@ void virtio_gpu_update_cursor_data(VirtIOGPU *g,
         return;
     }
 
-    if (res->blob_size) {
-        if (res->blob_size < (s->current_cursor->width *
-                              s->current_cursor->height * 4)) {
-            return;
-        }
-        data = res->blob;
-    } else {
+    if (res->image) {
         if (pixman_image_get_width(res->image)  != s->current_cursor->width ||
             pixman_image_get_height(res->image) != s->current_cursor->height) {
             return;
         }
         data = pixman_image_get_data(res->image);
+    } else {
+        if (res->blob_size < (s->current_cursor->width *
+                              s->current_cursor->height * 4)) {
+            return;
+        }
+        data = res->blob;
     }
 
     pixels = s->current_cursor->width * s->current_cursor->height;
@@ -1286,7 +1286,7 @@ static int virtio_gpu_save(QEMUFile *f, void *opaque, size_t size,
     assert(QTAILQ_EMPTY(&g->cmdq));
 
     QTAILQ_FOREACH(res, &g->reslist, next) {
-        if (res->blob_size) {
+        if (!res->image) {
             continue;
         }
         qemu_put_be32(f, res->resource_id);
@@ -1437,7 +1437,7 @@ static int virtio_gpu_blob_save(QEMUFile *f, void *opaque, size_t size,
     assert(QTAILQ_EMPTY(&g->cmdq));
 
     QTAILQ_FOREACH(res, &g->reslist, next) {
-        if (!res->blob_size) {
+        if (res->image) {
             continue;
         }
         assert(!res->image);

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 10/23] hw/display/virtio-gpu: Initialize blob mapping for ATTACH_BACKING
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (8 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 09/23] hw/display/virtio-gpu: Fix empty blob discrimination Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 11/23] hw/display/virtio-gpu: Avoid leaking migration blocker Marc-André Lureau
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel
  Cc: Stefan Hajnoczi, Alex Bennée, Akihiko Odaki, Dmitry Osipenko,
	Michael S. Tsirkin

From: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>

It is necessary for blob cursor and scanout.

Fixes: e0933d91b1cd ("virtio-gpu: Add virtio_gpu_resource_create_blob")
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260725-backing-v1-1-5b584bf7df5a@rsg.ci.i.u-tokyo.ac.jp>
---
 hw/display/virtio-gpu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index add60926f366..4d46a4eb10fa 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -992,6 +992,10 @@ virtio_gpu_resource_attach_backing(VirtIOGPU *g,
         cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
         return;
     }
+
+    if (!res->image) {
+        virtio_gpu_init_udmabuf(res);
+    }
 }
 
 static void

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 11/23] hw/display/virtio-gpu: Avoid leaking migration blocker
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (9 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 10/23] hw/display/virtio-gpu: Initialize blob mapping for ATTACH_BACKING Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 12/23] hw/display/virtio-gpu: Block Rutabaga migration Marc-André Lureau
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel
  Cc: Stefan Hajnoczi, Michael S. Tsirkin, Alex Bennée,
	Akihiko Odaki, Dmitry Osipenko

From: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>

virtio_gpu_base_device_realize() leaks a migration blocker if a
check of the output list fails after adding one. Perform the check
before adding a migration blocker to avoid the leak. This also
simplifies the code by merging two loops.

Fixes: d3a4969dc5ac ("Support per-head resolutions with virtio-gpu")
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260725-virgl-v1-1-58bb51e60da5@rsg.ci.i.u-tokyo.ac.jp>
---
 hw/display/virtio-gpu-base.c | 37 ++++++++++++++++---------------------
 1 file changed, 16 insertions(+), 21 deletions(-)

diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c
index a68b18482956..946e56b42f61 100644
--- a/hw/display/virtio-gpu-base.c
+++ b/hw/display/virtio-gpu-base.c
@@ -195,6 +195,11 @@ virtio_gpu_base_device_realize(DeviceState *qdev,
         return false;
     }
 
+    g->enabled_output_bitmask = 1;
+
+    g->req_state[0].width = g->conf.xres;
+    g->req_state[0].height = g->conf.yres;
+
     for (output_idx = 0, node = g->conf.outputs;
          node; output_idx++, node = node->next) {
         if (output_idx == g->conf.max_outputs) {
@@ -207,6 +212,17 @@ virtio_gpu_base_device_realize(DeviceState *qdev,
                        node->value->name, EDID_NAME_MAX_LENGTH);
             return false;
         }
+        if (node->value->has_xres != node->value->has_yres) {
+            error_setg(errp,
+                       "must set both outputs[%zd].xres and outputs[%zd].yres",
+                       output_idx, output_idx);
+            return false;
+        }
+        if (node->value->has_xres && node->value->has_yres) {
+            g->enabled_output_bitmask |= (1 << output_idx);
+            g->req_state[output_idx].width = node->value->xres;
+            g->req_state[output_idx].height = node->value->yres;
+        }
     }
 
     if (virtio_gpu_virgl_enabled(g->conf)) {
@@ -229,27 +245,6 @@ virtio_gpu_base_device_realize(DeviceState *qdev,
         virtio_add_queue(vdev, 16, cursor_cb);
     }
 
-    g->enabled_output_bitmask = 1;
-
-    g->req_state[0].width = g->conf.xres;
-    g->req_state[0].height = g->conf.yres;
-
-    for (output_idx = 0, node = g->conf.outputs;
-         node && output_idx < g->conf.max_outputs;
-         output_idx++, node = node->next) {
-        if (node->value->has_xres != node->value->has_yres) {
-            error_setg(errp,
-                       "must set both outputs[%zd].xres and outputs[%zd].yres",
-                       output_idx, output_idx);
-            return false;
-        }
-        if (node->value->has_xres && node->value->has_yres) {
-            g->enabled_output_bitmask |= (1 << output_idx);
-            g->req_state[output_idx].width = node->value->xres;
-            g->req_state[output_idx].height = node->value->yres;
-        }
-    }
-
     g->hw_ops = &virtio_gpu_ops;
     for (i = 0; i < g->conf.max_outputs; i++) {
         g->scanout[i].con =

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 12/23] hw/display/virtio-gpu: Block Rutabaga migration
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (10 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 11/23] hw/display/virtio-gpu: Avoid leaking migration blocker Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 13/23] hw/display/virtio-gpu-rutabaga: zero-init capset info response Marc-André Lureau
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel
  Cc: Stefan Hajnoczi, Michael S. Tsirkin, Alex Bennée,
	Akihiko Odaki, Dmitry Osipenko

From: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>

The migration stream encoding is not defined for Rutabaga yet.

Fixes: 1dcc6adbc168 ("gfxstream + rutabaga: add initial support for gfxstream")
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260725-rutabaga-v1-1-4832b56e679d@rsg.ci.i.u-tokyo.ac.jp>
---
 hw/display/virtio-gpu-rutabaga.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/hw/display/virtio-gpu-rutabaga.c b/hw/display/virtio-gpu-rutabaga.c
index 6af5c2514d23..8e6c7a0d5ddc 100644
--- a/hw/display/virtio-gpu-rutabaga.c
+++ b/hw/display/virtio-gpu-rutabaga.c
@@ -9,6 +9,7 @@
 #include "hw/virtio/virtio-gpu.h"
 #include "hw/virtio/virtio-gpu-pixman.h"
 #include "hw/virtio/virtio-iommu.h"
+#include "migration/blocker.h"
 
 #include <glib/gmem.h>
 #include <rutabaga_gfx/rutabaga_gfx_ffi.h>
@@ -1078,6 +1079,7 @@ static void virtio_gpu_rutabaga_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
 
 static void virtio_gpu_rutabaga_realize(DeviceState *qdev, Error **errp)
 {
+    ERRP_GUARD();
     uint32_t num_capsets;
     VirtIOGPUBase *bdev = VIRTIO_GPU_BASE(qdev);
     VirtIOGPU *gpudev = VIRTIO_GPU(qdev);
@@ -1087,12 +1089,17 @@ static void virtio_gpu_rutabaga_realize(DeviceState *qdev, Error **errp)
     return;
 #endif
 
-    if (!virtio_gpu_rutabaga_init(gpudev, errp)) {
+    error_setg(&bdev->migration_blocker, "rutabaga is not yet migratable");
+    if (migrate_add_blocker(&bdev->migration_blocker, errp) < 0) {
         return;
     }
 
+    if (!virtio_gpu_rutabaga_init(gpudev, errp)) {
+        goto fail;
+    }
+
     if (!virtio_gpu_rutabaga_get_num_capsets(gpudev, &num_capsets, errp)) {
-        return;
+        goto fail;
     }
 
     bdev->conf.flags |= (1 << VIRTIO_GPU_FLAG_RUTABAGA_ENABLED);
@@ -1101,6 +1108,12 @@ static void virtio_gpu_rutabaga_realize(DeviceState *qdev, Error **errp)
 
     bdev->virtio_config.num_capsets = num_capsets;
     virtio_gpu_device_realize(qdev, errp);
+    if (!*errp) {
+        return;
+    }
+
+fail:
+    migrate_del_blocker(&bdev->migration_blocker);
 }
 
 static const Property virtio_gpu_rutabaga_properties[] = {

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 13/23] hw/display/virtio-gpu-rutabaga: zero-init capset info response
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (11 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 12/23] hw/display/virtio-gpu: Block Rutabaga migration Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 14/23] hw/cxl: fix invalid free on early return Marc-André Lureau
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel
  Cc: Stefan Hajnoczi, Michael S. Tsirkin, Alex Bennée,
	Akihiko Odaki, Dmitry Osipenko

rutabaga_cmd_get_capset_info() only fills in capset_id,
capset_max_version and capset_max_size before sending the response to
the guest. The remaining fields of struct virtio_gpu_resp_capset_info,
including hdr.fence_id, hdr.ctx_id and hdr.ring_idx, are left with
stack garbage and leaked to the guest, including host pointers useful
for an ASLR bypass.

Zero the response first, matching virgl_cmd_get_capset_info().

Not a real risk thanks to -ftrivial-auto-var-init=zero, but only with
gcc >= 12 or clang >= 16.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3609
Fixes: 1dcc6adbc168 ("gfxstream + rutabaga: add initial support for gfxstream")
Reported-by: Haotian Jiang <jianghaotian.sunday@gmail.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu-rutabaga.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/display/virtio-gpu-rutabaga.c b/hw/display/virtio-gpu-rutabaga.c
index 8e6c7a0d5ddc..e28aad94eead 100644
--- a/hw/display/virtio-gpu-rutabaga.c
+++ b/hw/display/virtio-gpu-rutabaga.c
@@ -556,6 +556,8 @@ rutabaga_cmd_get_capset_info(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd)
 
     VIRTIO_GPU_FILL_CMD(info);
 
+    memset(&resp, 0, sizeof(resp));
+
     result = rutabaga_get_capset_info(vr->rutabaga, info.capset_index,
                                       &resp.capset_id, &resp.capset_max_version,
                                       &resp.capset_max_size);

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 14/23] hw/cxl: fix invalid free on early return
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (12 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 13/23] hw/display/virtio-gpu-rutabaga: zero-init capset info response Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 15/23] hw/hexagon: fix machine->fdt leak in qom-test Marc-André Lureau
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi, Jonathan Cameron, linux-cxl

docs/devel/style.rst:

 * Variables declared with g_auto* MUST always be initialized,
   otherwise the cleanup function will use uninitialized stack memory

Fixes: 680935c9a6ff ("hw/cxl: Add a performant (and correct) path for the non interleaved cases")
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/cxl/cxl-host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c
index 7e744312f1d8..eba13c9e7cba 100644
--- a/hw/cxl/cxl-host.c
+++ b/hw/cxl/cxl-host.c
@@ -279,7 +279,7 @@ static void cxl_fmws_direct_passthrough_setup(CXLDirectPTState *state,
     MemoryRegion *mr = NULL;
     uint64_t vmr_size = 0, pmr_size = 0, offset = 0;
     MemoryRegion *direct_mr;
-    g_autofree char *direct_mr_name;
+    g_autofree char *direct_mr_name = NULL;
     unsigned int idx = state->hdm_decoder_idx;
 
     if (ct3d->hostvmem) {

-- 
2.55.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 15/23] hw/hexagon: fix machine->fdt leak in qom-test
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (13 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 14/23] hw/cxl: fix invalid free on early return Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 16/23] block/blkio: fix compiler false-positive warning Marc-André Lureau
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi, Brian Cain, Pierrick Bouvier

virt_instance_init() built the FDT unconditionally at QOM
instance-init time, so simply instantiating the object (e.g. via
qom-test's introspection, without ever realizing the machine) leaked
the 1MB FDT blob: machine_finalize() does not free machine->fdt.

Other boards (arm/virt, riscv/virt, ...) build the FDT lazily from
their MachineClass::init callback, which only runs when the machine
is actually selected to boot. Do the same here by moving create_fdt()
into virt_init().

Fixes: 88a8bc7f43ff ("hw/hexagon: Define hexagon "virt" machine")
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/hexagon/virt.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/hw/hexagon/virt.c b/hw/hexagon/virt.c
index a3638998b873..b75047250260 100644
--- a/hw/hexagon/virt.c
+++ b/hw/hexagon/virt.c
@@ -175,13 +175,6 @@ static void fdt_add_cpu_nodes(const HexagonVirtMachineState *vms)
 
 
 
-static void virt_instance_init(Object *obj)
-{
-    HexagonVirtMachineState *vms = HEXAGON_VIRT_MACHINE(obj);
-
-    create_fdt(vms);
-}
-
 void hexagon_load_fdt(const HexagonVirtMachineState *vms)
 {
     MachineState *ms = MACHINE(vms);
@@ -242,6 +235,7 @@ static void virt_init(MachineState *ms)
     DeviceState *cpu0;
     int32_t clk_phandle;
 
+    create_fdt(vms);
     qemu_fdt_setprop_string(ms->fdt, "/chosen", "bootargs", ms->kernel_cmdline);
 
     vms->sys = get_system_memory();
@@ -341,7 +335,6 @@ static const TypeInfo virt_machine_types[] = { {
     .parent = TYPE_HEXAGON_COMMON_MACHINE,
     .instance_size = sizeof(HexagonVirtMachineState),
     .class_init = virt_class_init,
-    .instance_init = virt_instance_init,
 } };
 
 DEFINE_TYPES(virt_machine_types)

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 16/23] block/blkio: fix compiler false-positive warning
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (14 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 15/23] hw/hexagon: fix machine->fdt leak in qom-test Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 17/23] monitor: annotate monitor_qmp_dispatcher_pop_any() as coroutine Marc-André Lureau
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi, Kevin Wolf, Hanna Reitz, qemu-block

Under some optimization, gcc produces a false-positive:
    ../block/blkio.c: In function ‘blkio_co_getlength’:
    ../block/blkio.c:943:8: error: ‘ret’ may be used uninitialized [-Werror=maybe-uninitialized]
      943 |     if (ret < 0) {
          |        ^

Replace WITH_QEMU_LOCK_GUARD with the simpler QEMU_LOCK_GUARD.

Suggested-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 block/blkio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/block/blkio.c b/block/blkio.c
index fb8bec27d71a..008320bf2061 100644
--- a/block/blkio.c
+++ b/block/blkio.c
@@ -937,9 +937,8 @@ static int64_t coroutine_fn blkio_co_getlength(BlockDriverState *bs)
     uint64_t capacity;
     int ret;
 
-    WITH_QEMU_LOCK_GUARD(&s->blkio_lock) {
-        ret = blkio_get_uint64(s->blkio, "capacity", &capacity);
-    }
+    QEMU_LOCK_GUARD(&s->blkio_lock);
+    ret = blkio_get_uint64(s->blkio, "capacity", &capacity);
     if (ret < 0) {
         return -ret;
     }

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 17/23] monitor: annotate monitor_qmp_dispatcher_pop_any() as coroutine
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (15 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 16/23] block/blkio: fix compiler false-positive warning Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 18/23] migration: fix qemu_get_counted_string annotation Marc-André Lureau
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi, Markus Armbruster

The function calls qemu_coroutine_yield(), and is called from
monitor_qmp_dispatcher_co().

Fixes: 60f4f62efeb ("monitor: extract request dequeuing to a new function")
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 monitor/qmp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/monitor/qmp.c b/monitor/qmp.c
index 223e0643c2ad..338d37cb7e5a 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
@@ -342,7 +342,8 @@ static QMPRequest *monitor_qmp_requests_pop_any_with_lock(void)
     return req_obj;
 }
 
-static QMPRequest *monitor_qmp_dispatcher_pop_any(void)
+static QMPRequest * coroutine_fn
+monitor_qmp_dispatcher_pop_any(void)
 {
     while (true) {
         /*

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 18/23] migration: fix qemu_get_counted_string annotation
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (16 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 17/23] monitor: annotate monitor_qmp_dispatcher_pop_any() as coroutine Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 19/23] io: add missing coroutine annotation Marc-André Lureau
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi, Peter Xu, Fabiano Rosas

Fixes: 394b9407e4c ("migration: mark mixed functions that can suspend")
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 migration/qemu-file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index d5a48115bd63..f30e13c66d77 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -830,7 +830,7 @@ uint64_t qemu_get_be64(QEMUFile *f)
  *          else 0
  *          (Note a 0 length string will return 0 either way)
  */
-size_t coroutine_fn qemu_get_counted_string(QEMUFile *f, char buf[256])
+size_t coroutine_mixed_fn qemu_get_counted_string(QEMUFile *f, char buf[256])
 {
     size_t len = qemu_get_byte(f);
     size_t res = qemu_get_buffer(f, (uint8_t *)buf, len);

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 19/23] io: add missing coroutine annotation
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (17 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 18/23] migration: fix qemu_get_counted_string annotation Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 20/23] block: " Marc-André Lureau
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi, Daniel P. Berrangé

Fixes: 1edf0df28409 ("io: Add qio_channel_wait_cond() helper")
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/io/channel.h | 4 ++--
 io/channel.c         | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/io/channel.h b/include/io/channel.h
index 98485c9280a6..c90ace20d535 100644
--- a/include/io/channel.h
+++ b/include/io/channel.h
@@ -1016,8 +1016,8 @@ void qio_channel_wait(QIOChannel *ioc,
  * This will work with/without a coroutine context, by automatically select
  * the proper API to wait.
  */
-void qio_channel_wait_cond(QIOChannel *ioc,
-                           GIOCondition condition);
+void coroutine_mixed_fn qio_channel_wait_cond(QIOChannel *ioc,
+                        GIOCondition condition);
 
 /**
  * qio_channel_set_aio_fd_handler:
diff --git a/io/channel.c b/io/channel.c
index 2853dadb684e..620256f310db 100644
--- a/io/channel.c
+++ b/io/channel.c
@@ -905,8 +905,9 @@ void qio_channel_wait(QIOChannel *ioc,
     g_main_context_unref(ctxt);
 }
 
-void qio_channel_wait_cond(QIOChannel *ioc,
-                           GIOCondition condition)
+void coroutine_mixed_fn
+qio_channel_wait_cond(QIOChannel *ioc,
+                      GIOCondition condition)
 {
     if (qemu_in_coroutine()) {
         qio_channel_yield(ioc, condition);

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 20/23] block: add missing coroutine annotation
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (18 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 19/23] io: add missing coroutine annotation Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 21/23] qcow2: remove invalid qcow2_check_refcounts calls Marc-André Lureau
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel
  Cc: Stefan Hajnoczi, John Snow, Vladimir Sementsov-Ogievskiy,
	Kevin Wolf, Hanna Reitz, qemu-block

The function was extracted without carrying the annotation.

Fixes: 23743ab282af ("block: move commit_run loop to separate function")
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 block/commit.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/commit.c b/block/commit.c
index c5e3ef03a21b..2d52c39594cd 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -128,8 +128,9 @@ static void commit_clean(Job *job)
     blk_unref(s->top);
 }
 
-static int commit_iteration(CommitBlockJob *s, int64_t offset,
-                            int64_t *requested_bytes, void *buf)
+static int coroutine_fn
+commit_iteration(CommitBlockJob *s, int64_t offset,
+                 int64_t *requested_bytes, void *buf)
 {
     BlockErrorAction action;
     int64_t bytes = *requested_bytes;

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 21/23] qcow2: remove invalid qcow2_check_refcounts calls
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (19 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 20/23] block: " Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 22/23] hw/9pfs: annotate V9fsTransport callbacks as coroutine_fn Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 23/23] migration/rdma: annotate and simplify wait_comp_channel() Marc-André Lureau
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi, Kevin Wolf, Hanna Reitz, qemu-block

Those DEBUG_ALLOC-guarded are dead code incorrectly calling coroutine fn
from non-coroutine. Remove it.

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Fixes: 70bacc44532 ("qcow2: mark more functions as coroutine_fns and  GRAPH_RDLOCK")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 block/qcow2-snapshot.c | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
index 1e8dc48be1c5..8453ad73d10f 100644
--- a/block/qcow2-snapshot.c
+++ b/block/qcow2-snapshot.c
@@ -740,12 +740,6 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
                           ROUND_UP(sn->vm_state_size, s->cluster_size),
                           QCOW2_DISCARD_NEVER, false);
 
-#ifdef DEBUG_ALLOC
-    {
-      BdrvCheckResult result = {0};
-      qcow2_check_refcounts(bs, &result, 0);
-    }
-#endif
     return 0;
 
 fail:
@@ -893,12 +887,6 @@ int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
         goto fail;
     }
 
-#ifdef DEBUG_ALLOC
-    {
-        BdrvCheckResult result = {0};
-        qcow2_check_refcounts(bs, &result, 0);
-    }
-#endif
     return 0;
 
 fail:
@@ -975,12 +963,6 @@ int qcow2_snapshot_delete(BlockDriverState *bs,
         return ret;
     }
 
-#ifdef DEBUG_ALLOC
-    {
-        BdrvCheckResult result = {0};
-        qcow2_check_refcounts(bs, &result, 0);
-    }
-#endif
     return 0;
 }
 

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 22/23] hw/9pfs: annotate V9fsTransport callbacks as coroutine_fn
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (20 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 21/23] qcow2: remove invalid qcow2_check_refcounts calls Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  2026-07-27 11:51 ` [GIT PULL 23/23] migration/rdma: annotate and simplify wait_comp_channel() Marc-André Lureau
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel
  Cc: Stefan Hajnoczi, Christian Schoenebeck, Greg Kurz,
	Michael S. Tsirkin, Stefano Stabellini, Anthony PERARD,
	Edgar E. Iglesias, xen-devel

All V9fsTransport callbacks are invoked exclusively from coroutine
context (the v9fs_* PDU handlers). Annotate the function pointer
types in V9fsTransport and all implementations (virtio and xen
backends), as well as intermediate callers in 9p.c (pdu_marshal,
pdu_unmarshal, v9fs_init_qiov_from_pdu, etc.).

Acked-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/9pfs/9p.h               | 26 +++++++++++++++-----------
 hw/9pfs/9p.c               | 31 +++++++++++++++++++------------
 hw/9pfs/virtio-9p-device.c | 24 +++++++++++++-----------
 hw/9pfs/xen-9p-backend.c   | 34 +++++++++++++++++-----------------
 4 files changed, 64 insertions(+), 51 deletions(-)

diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h
index 1a309664f6e3..0e52ffbdf38b 100644
--- a/hw/9pfs/9p.h
+++ b/hw/9pfs/9p.h
@@ -472,17 +472,21 @@ void pdu_submit(V9fsPDU *pdu, P9MsgHeader *hdr);
 void v9fs_reset(V9fsState *s);
 
 struct V9fsTransport {
-    ssize_t     (*pdu_vmarshal)(V9fsPDU *pdu, size_t offset, const char *fmt,
-                                va_list ap);
-    ssize_t     (*pdu_vunmarshal)(V9fsPDU *pdu, size_t offset, const char *fmt,
-                                  va_list ap);
-    void        (*init_in_iov_from_pdu)(V9fsPDU *pdu, struct iovec **piov,
-                                        unsigned int *pniov, size_t size);
-    void        (*init_out_iov_from_pdu)(V9fsPDU *pdu, struct iovec **piov,
-                                         unsigned int *pniov, size_t size);
-    void        (*push_and_notify)(V9fsPDU *pdu);
-    size_t      (*msize_limit)(V9fsState *s);
-    size_t      (*response_buffer_size)(V9fsPDU *pdu);
+    ssize_t     coroutine_fn (*pdu_vmarshal)(V9fsPDU *pdu, size_t offset,
+                                             const char *fmt, va_list ap);
+    ssize_t     coroutine_fn (*pdu_vunmarshal)(V9fsPDU *pdu, size_t offset,
+                                               const char *fmt, va_list ap);
+    void        coroutine_fn (*init_in_iov_from_pdu)(V9fsPDU *pdu,
+                                                     struct iovec **piov,
+                                                     unsigned int *pniov,
+                                                     size_t size);
+    void        coroutine_fn (*init_out_iov_from_pdu)(V9fsPDU *pdu,
+                                                      struct iovec **piov,
+                                                      unsigned int *pniov,
+                                                      size_t size);
+    void        coroutine_fn (*push_and_notify)(V9fsPDU *pdu);
+    size_t      coroutine_fn (*msize_limit)(V9fsState *s);
+    size_t      coroutine_fn (*response_buffer_size)(V9fsPDU *pdu);
 };
 
 #endif
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 1c61e6b3e773..4764d9db13b1 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -55,7 +55,8 @@ enum {
 
 P9ARRAY_DEFINE_TYPE(V9fsPath, v9fs_path_free);
 
-static ssize_t pdu_marshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...)
+static ssize_t coroutine_fn
+pdu_marshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...)
 {
     ssize_t ret;
     va_list ap;
@@ -67,7 +68,8 @@ static ssize_t pdu_marshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...)
     return ret;
 }
 
-static ssize_t pdu_unmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...)
+static ssize_t coroutine_fn
+pdu_unmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...)
 {
     ssize_t ret;
     va_list ap;
@@ -1841,7 +1843,8 @@ out_nofid:
     pdu_complete(pdu, err);
 }
 
-static int v9fs_walk_marshal(V9fsPDU *pdu, uint16_t nwnames, V9fsQID *qids)
+static int coroutine_fn
+v9fs_walk_marshal(V9fsPDU *pdu, uint16_t nwnames, V9fsQID *qids)
 {
     int i;
     ssize_t err;
@@ -2363,9 +2366,10 @@ out_nofid:
  * The resulting QEMUIOVector has heap-allocated iovecs and must be cleaned up
  * with qemu_iovec_destroy().
  */
-static void v9fs_init_qiov_from_pdu(QEMUIOVector *qiov, V9fsPDU *pdu,
-                                    size_t skip, size_t size,
-                                    bool is_write)
+static void coroutine_fn
+v9fs_init_qiov_from_pdu(QEMUIOVector *qiov, V9fsPDU *pdu,
+                        size_t skip, size_t size,
+                        bool is_write)
 {
     QEMUIOVector elem;
     struct iovec *iov;
@@ -2382,8 +2386,9 @@ static void v9fs_init_qiov_from_pdu(QEMUIOVector *qiov, V9fsPDU *pdu,
     qemu_iovec_concat(qiov, &elem, skip, size);
 }
 
-static int v9fs_xattr_read(V9fsState *s, V9fsPDU *pdu, V9fsFidState *fidp,
-                           uint64_t off, uint32_t max_count)
+static int coroutine_fn
+v9fs_xattr_read(V9fsState *s, V9fsPDU *pdu, V9fsFidState *fidp,
+                uint64_t off, uint32_t max_count)
 {
     ssize_t err;
     size_t offset = 7;
@@ -2793,9 +2798,10 @@ out_nofid:
     pdu_complete(pdu, retval);
 }
 
-static int v9fs_xattr_write(V9fsState *s, V9fsPDU *pdu, V9fsFidState *fidp,
-                            uint64_t off, uint32_t count,
-                            struct iovec *sg, int cnt)
+static int coroutine_fn
+v9fs_xattr_write(V9fsState *s, V9fsPDU *pdu, V9fsFidState *fidp,
+                 uint64_t off, uint32_t count,
+                 struct iovec *sg, int cnt)
 {
     int i, to_copy;
     ssize_t err = 0;
@@ -3729,7 +3735,8 @@ out_nofid:
     pdu_complete(pdu, err);
 }
 
-static int v9fs_fill_statfs(V9fsState *s, V9fsPDU *pdu, struct statfs *stbuf)
+static int coroutine_fn
+v9fs_fill_statfs(V9fsState *s, V9fsPDU *pdu, struct statfs *stbuf)
 {
     uint32_t f_type;
     uint32_t f_bsize;
diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
index 576a794ea434..2774fc2290a8 100644
--- a/hw/9pfs/virtio-9p-device.c
+++ b/hw/9pfs/virtio-9p-device.c
@@ -28,7 +28,7 @@
 #include "qemu/module.h"
 #include "system/qtest.h"
 
-static void virtio_9p_push_and_notify(V9fsPDU *pdu)
+static void coroutine_fn virtio_9p_push_and_notify(V9fsPDU *pdu)
 {
     V9fsState *s = pdu->s;
     V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);
@@ -117,8 +117,8 @@ static void virtio_9p_reset(VirtIODevice *vdev)
     v9fs_reset(&v->state);
 }
 
-static ssize_t virtio_pdu_vmarshal(V9fsPDU *pdu, size_t offset,
-                                   const char *fmt, va_list ap)
+static ssize_t coroutine_fn
+virtio_pdu_vmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, va_list ap)
 {
     V9fsState *s = pdu->s;
     V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);
@@ -135,8 +135,8 @@ static ssize_t virtio_pdu_vmarshal(V9fsPDU *pdu, size_t offset,
     return ret;
 }
 
-static ssize_t virtio_pdu_vunmarshal(V9fsPDU *pdu, size_t offset,
-                                     const char *fmt, va_list ap)
+static ssize_t coroutine_fn
+virtio_pdu_vunmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, va_list ap)
 {
     V9fsState *s = pdu->s;
     V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);
@@ -152,8 +152,9 @@ static ssize_t virtio_pdu_vunmarshal(V9fsPDU *pdu, size_t offset,
     return ret;
 }
 
-static void virtio_init_in_iov_from_pdu(V9fsPDU *pdu, struct iovec **piov,
-                                        unsigned int *pniov, size_t size)
+static void coroutine_fn
+virtio_init_in_iov_from_pdu(V9fsPDU *pdu, struct iovec **piov,
+                            unsigned int *pniov, size_t size)
 {
     V9fsState *s = pdu->s;
     V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);
@@ -172,8 +173,9 @@ static void virtio_init_in_iov_from_pdu(V9fsPDU *pdu, struct iovec **piov,
     *pniov = elem->in_num;
 }
 
-static void virtio_init_out_iov_from_pdu(V9fsPDU *pdu, struct iovec **piov,
-                                         unsigned int *pniov, size_t size)
+static void coroutine_fn
+virtio_init_out_iov_from_pdu(V9fsPDU *pdu, struct iovec **piov,
+                             unsigned int *pniov, size_t size)
 {
     V9fsState *s = pdu->s;
     V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);
@@ -192,13 +194,13 @@ static void virtio_init_out_iov_from_pdu(V9fsPDU *pdu, struct iovec **piov,
     *pniov = elem->out_num;
 }
 
-static size_t virtio_9p_msize_limit(V9fsState *s)
+static size_t coroutine_fn virtio_9p_msize_limit(V9fsState *s)
 {
     const size_t guestPageSize = 4096;
     return (VIRTQUEUE_MAX_SIZE - 2) * guestPageSize;
 }
 
-static size_t virtio_9p_response_buffer_size(V9fsPDU *pdu)
+static size_t coroutine_fn virtio_9p_response_buffer_size(V9fsPDU *pdu)
 {
     V9fsState *s = pdu->s;
     V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);
diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
index d44fa8d61e2e..06709d54084b 100644
--- a/hw/9pfs/xen-9p-backend.c
+++ b/hw/9pfs/xen-9p-backend.c
@@ -136,10 +136,10 @@ static void xen_9pfs_out_sg(Xen9pfsRing *ring,
     }
 }
 
-static ssize_t xen_9pfs_pdu_vmarshal(V9fsPDU *pdu,
-                                     size_t offset,
-                                     const char *fmt,
-                                     va_list ap)
+static ssize_t coroutine_fn xen_9pfs_pdu_vmarshal(V9fsPDU *pdu,
+                                                  size_t offset,
+                                                  const char *fmt,
+                                                  va_list ap)
 {
     Xen9pfsDev *xen_9pfs = container_of(pdu->s, Xen9pfsDev, state);
     struct iovec in_sg[2];
@@ -161,10 +161,10 @@ static ssize_t xen_9pfs_pdu_vmarshal(V9fsPDU *pdu,
     return ret;
 }
 
-static ssize_t xen_9pfs_pdu_vunmarshal(V9fsPDU *pdu,
-                                       size_t offset,
-                                       const char *fmt,
-                                       va_list ap)
+static ssize_t coroutine_fn xen_9pfs_pdu_vunmarshal(V9fsPDU *pdu,
+                                                    size_t offset,
+                                                    const char *fmt,
+                                                    va_list ap)
 {
     Xen9pfsDev *xen_9pfs = container_of(pdu->s, Xen9pfsDev, state);
     struct iovec out_sg[2];
@@ -185,10 +185,10 @@ static ssize_t xen_9pfs_pdu_vunmarshal(V9fsPDU *pdu,
     return ret;
 }
 
-static void xen_9pfs_init_out_iov_from_pdu(V9fsPDU *pdu,
-                                           struct iovec **piov,
-                                           unsigned int *pniov,
-                                           size_t size)
+static void coroutine_fn xen_9pfs_init_out_iov_from_pdu(V9fsPDU *pdu,
+                                                        struct iovec **piov,
+                                                        unsigned int *pniov,
+                                                        size_t size)
 {
     Xen9pfsDev *xen_9pfs = container_of(pdu->s, Xen9pfsDev, state);
     Xen9pfsRing *ring = &xen_9pfs->rings[pdu->tag % xen_9pfs->num_rings];
@@ -202,10 +202,10 @@ static void xen_9pfs_init_out_iov_from_pdu(V9fsPDU *pdu,
     *pniov = num;
 }
 
-static void xen_9pfs_init_in_iov_from_pdu(V9fsPDU *pdu,
-                                          struct iovec **piov,
-                                          unsigned int *pniov,
-                                          size_t size)
+static void coroutine_fn xen_9pfs_init_in_iov_from_pdu(V9fsPDU *pdu,
+                                                       struct iovec **piov,
+                                                       unsigned int *pniov,
+                                                       size_t size)
 {
     Xen9pfsDev *xen_9pfs = container_of(pdu->s, Xen9pfsDev, state);
     Xen9pfsRing *ring = &xen_9pfs->rings[pdu->tag % xen_9pfs->num_rings];
@@ -234,7 +234,7 @@ again:
     *pniov = num;
 }
 
-static void xen_9pfs_push_and_notify(V9fsPDU *pdu)
+static void coroutine_fn xen_9pfs_push_and_notify(V9fsPDU *pdu)
 {
     RING_IDX prod;
     Xen9pfsDev *priv = container_of(pdu->s, Xen9pfsDev, state);

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [GIT PULL 23/23] migration/rdma: annotate and simplify wait_comp_channel()
  2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
                   ` (21 preceding siblings ...)
  2026-07-27 11:51 ` [GIT PULL 22/23] hw/9pfs: annotate V9fsTransport callbacks as coroutine_fn Marc-André Lureau
@ 2026-07-27 11:51 ` Marc-André Lureau
  22 siblings, 0 replies; 24+ messages in thread
From: Marc-André Lureau @ 2026-07-27 11:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi, Peter Xu, Fabiano Rosas, Li Zhijian

The function calls yield_until_fd_readable() (coroutine_fn) when in
coroutine context, and polls with qemu_poll_ns() otherwise.

Replace the migration-state proxy check with qemu_in_coroutine(),
which directly tests what matters.

Fixes: 2da776db4846 ("rdma: core logic")
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 migration/rdma.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/migration/rdma.c b/migration/rdma.c
index 3e37a1d44013..438419d18943 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -1348,17 +1348,13 @@ static int qemu_rdma_poll(RDMAContext *rdma, struct ibv_cq *cq,
 /* Wait for activity on the completion channel.
  * Returns 0 on success, none-0 on error.
  */
-static int qemu_rdma_wait_comp_channel(RDMAContext *rdma,
-                                       struct ibv_comp_channel *comp_channel)
+static int coroutine_mixed_fn
+qemu_rdma_wait_comp_channel(RDMAContext *rdma,
+                            struct ibv_comp_channel *comp_channel)
 {
     struct rdma_cm_event *cm_event;
 
-    /*
-     * Coroutine doesn't start until migration_fd_process_incoming()
-     * so don't yield unless we know we're running inside of a coroutine.
-     */
-    if (rdma->migration_started_on_destination &&
-        migration_incoming_get_current()->state == MIGRATION_STATUS_ACTIVE) {
+    if (qemu_in_coroutine()) {
         yield_until_fd_readable(comp_channel->fd);
     } else {
         /* This is the source side, we're in a separate thread

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2026-07-27 11:55 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-27 11:51 [GIT PULL 00/23] Fixes for 11.1-rc2 Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 01/23] hw/display/virtio-gpu: Remove the bytes_pp field Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 02/23] hw/display/vhost-user-gpu: validate message payload sizes Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 03/23] ui/vnc: remove redundant rows computation Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 04/23] hw/display/qxl: unregister vm_change_state handler and BHs Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 05/23] net/colo: fix g_hash_table_destroy assertion on uninitialized filter Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 06/23] target/i386/sev: fix MemoryRegion reference leaks in gpa2hva callers Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 07/23] virtio-gpu: fix NULL deref in rutabaga set_scanout Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 08/23] docs/hyperv: fix misleading hv-crash shutdown description Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 09/23] hw/display/virtio-gpu: Fix empty blob discrimination Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 10/23] hw/display/virtio-gpu: Initialize blob mapping for ATTACH_BACKING Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 11/23] hw/display/virtio-gpu: Avoid leaking migration blocker Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 12/23] hw/display/virtio-gpu: Block Rutabaga migration Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 13/23] hw/display/virtio-gpu-rutabaga: zero-init capset info response Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 14/23] hw/cxl: fix invalid free on early return Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 15/23] hw/hexagon: fix machine->fdt leak in qom-test Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 16/23] block/blkio: fix compiler false-positive warning Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 17/23] monitor: annotate monitor_qmp_dispatcher_pop_any() as coroutine Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 18/23] migration: fix qemu_get_counted_string annotation Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 19/23] io: add missing coroutine annotation Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 20/23] block: " Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 21/23] qcow2: remove invalid qcow2_check_refcounts calls Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 22/23] hw/9pfs: annotate V9fsTransport callbacks as coroutine_fn Marc-André Lureau
2026-07-27 11:51 ` [GIT PULL 23/23] migration/rdma: annotate and simplify wait_comp_channel() Marc-André Lureau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.