Re: [PATCH v2 2/3] drm/virtio: honor blob_alignment requirements

From: Michael S. Tsirkin

Date: Thu Jul 02 2026 - 00:03:57 EST


On Wed, Jul 01, 2026 at 01:10:30PM +0200, Alyssa Ross wrote:
> On Tue, Apr 28, 2026 at 09:44:49PM +0200, Sergio Lopez wrote:
> > If VIRTIO_GPU_F_BLOB_ALIGNMENT has been negotiated, blob size must be
> > aligned to blob_alignment. Validate this in verify_blob() so that
> > invalid requests are rejected early.
> >
> > Signed-off-by: Sergio Lopez <slp@xxxxxxxxxx>
>
> FYI: this change breaks crosvm, which is squatting the 5 and 6 values
> of VIRTIO_GPU_F_* with different meanings. I've reported it as a
> crosvm bug, so hopefully it can be taken care of there.
>
> https://issuetracker.google.com/issues/529852979

Move fast and beak things, then it takes a wile to fix them)
Do you understand who uses it maybe? Maybe if there's a PR
for both sides it will be handled faster.

> > ---
> > drivers/gpu/drm/virtio/virtgpu_ioctl.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> > index c33c057365f8..d0c4edf1eaf4 100644
> > --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> > +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> > @@ -489,6 +489,11 @@ static int verify_blob(struct virtio_gpu_device *vgdev,
> > params->size = rc_blob->size;
> > params->blob = true;
> > params->blob_flags = rc_blob->blob_flags;
> > +
> > + if (vgdev->has_blob_alignment &&
> > + !IS_ALIGNED(params->size, vgdev->blob_alignment))
> > + return -EINVAL;
> > +
> > return 0;
> > }
> >
> > --
> > 2.53.0
> >