Skip to content

virtio-gpu: reject non-32bpp cursor resources

Marc-André Lureau qemu-devel 1 version In review

Get series with b4
b4 am [email protected] change-id 20261104-master-b659997e3be3

Versions newest first

  1. v1 Latest4 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4virtio-gpu: make some 2d callbacks staticshw/display/virtio-gpu.c include/hw/virtio/virtio-gpu.h+7 -92 replies
2/4virtio-gpu/gl: reject non-32bpp cursor resourceshw/display/virtio-gpu-gl.c include/hw/virtio/virtio-gpu-pixman.h+31 -02 replies
3/4virtio-gpu/rutabaga: reject non-32bpp cursor resourceshw/display/virtio-gpu-rutabaga.c+16 -32 replies
4/4contrib/vhost-user-gpu: reject non-32bpp cursor resourcescontrib/vhost-user-gpu/vhost-user-gpu.c contrib/vhost-user-gpu/virgl.c contrib/vhost-user-gpu/virgl.h+39 -192 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchDaniel P. BerrangéAkihiko Odaki
1/4R-b R-b
2/4R-b R-b
3/4R-b R-b
4/4R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] virtio-gpu: reject non-32bpp cursor resources

Cursor data is copied out of the resource as 32bpp BGRA by every accelerated backend, but none of them checks the resource format first. (the 2d backend rejects any resource format that is not 32bpp already)

Refuse cursor resources that are not 32bpp in the three backends, reusing virtio_gpu_get_pixman_format() as the allowlist, and log the dimension mismatch in the rutabaga backend as the others do. Supported formats keep working unchanged.

The vhost-user-gpu cursor path also leaked the virgl buffer when the size check failed, so a guest could grow the backend memory with repeated UPDATE_CURSOR commands. Release it with g_autofree, and skip the update instead of sending zero-filled cursor pixels when no data was produced.

First patch is a trivial cleanup.

The virglrenderer side is fixed with
https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1703

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4756

---
Marc-André Lureau (4):
virtio-gpu: make some 2d callbacks statics virtio-gpu/gl: reject non-32bpp cursor resources virtio-gpu/rutabaga: reject non-32bpp cursor resources contrib/vhost-user-gpu: reject non-32bpp cursor resources

 contrib/vhost-user-gpu/vhost-user-gpu.c | 31 ++++++++++++++++++++-----------
 contrib/vhost-user-gpu/virgl.c          | 25 ++++++++++++++++++-------
 contrib/vhost-user-gpu/virgl.h          |  2 +-
 hw/display/virtio-gpu-gl.c              | 18 ++++++++++++++++++
 hw/display/virtio-gpu-rutabaga.c        | 19 ++++++++++++++++---
 hw/display/virtio-gpu.c                 | 12 +++++++-----
 include/hw/virtio/virtio-gpu-pixman.h   | 13 +++++++++++++
 include/hw/virtio/virtio-gpu.h          |  4 ----
 8 files changed, 93 insertions(+), 31 deletions(-)

---
base-commit: 723622bedb0b423de7d1c61ebbe6e7a71934949c
change-id: 20261104-master-b659997e3be3

Best regards,

Signature · 1 line
Marc-André Lureau <[email protected]>