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 Signed-off-by: Marc-André Lureau <[email protected]> --- 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, -- Marc-André Lureau <[email protected]>
