Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] drm/virtio: blob size alignment check is bypassed for 2D devices
--

commit e9be6e8827fcf796e95413bb22d054eb21acf9b4
Author: Val Packett <[email protected]>

drm/virtio: do not enforce blob_alignment in cross-domain contexts

This commit stops enforcing blob_alignment requirements in cross-domain
contexts. Resources created under these contexts are arbitrary shared system
memory files rather than GPU rendering contexts, so alignment is no longer
strictly enforced.

Link: 
https://lore.kernel.org/all/[email protected]/

> diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c 
> b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> index 81e70a12b3569..c28534593b2f4 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> @@ -539,7 +539,9 @@ static int verify_blob(struct virtio_gpu_device *vgdev,
>       params->blob_flags = rc_blob->blob_flags;
>       params->blob_hints = rc_blob->blob_hints;
>  
> -     if (vgdev->has_blob_alignment &&
> +     if (vgdev->has_blob_alignment && vgdev->has_virgl_3d &&
> +         (vfpriv->context_init & VIRTIO_GPU_CONTEXT_INIT_CAPSET_ID_MASK) !=
> +         VIRTIO_GPU_CAPSET_CROSS_DOMAIN &&
>           !IS_ALIGNED(params->size, vgdev->blob_alignment))
>               return -EINVAL;

[Severity: Medium]
Does adding the vgdev->has_virgl_3d check here completely bypass the size
alignment validation for 2D devices?

If has_virgl_3d is false, the condition short-circuits and skips the
IS_ALIGNED() check entirely. This seems to allow userspace to request
unaligned blob sizes on non-3D devices, which could potentially cause
host-side errors or command rejection.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to