Linux virtualization list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Val Packett" <val@invisiblethingslab.com>
Cc: dri-devel@lists.freedesktop.org,
	"Michael S. Tsirkin" <mst@redhat.com>,
	virtualization@lists.linux.dev,
	"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH v2] drm/virtio: do not enforce blob_alignment in cross-domain contexts
Date: Tue, 06 Oct 2026 15:58:52 +0000	[thread overview]
Message-ID: <20261006155852.5E92A1F0089B@smtp.kernel.org> (raw)
In-Reply-To: <20261006154913.2689067-2-val@invisiblethingslab.com>

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 <val@invisiblethingslab.com>

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/20261006004044.2242154-1-val@invisiblethingslab.com/

> 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/20261006154913.2689067-2-val@invisiblethingslab.com?part=1

  reply	other threads:[~2026-10-06 15:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 15:42 [PATCH v2] drm/virtio: do not enforce blob_alignment in cross-domain contexts Val Packett
2026-10-06 15:58 ` sashiko-bot [this message]
2026-10-08  7:33 ` Dmitry Osipenko
2026-10-08 20:59   ` Val Packett
2026-10-09 11:03     ` Dmitry Osipenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261006155852.5E92A1F0089B@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eperezma@redhat.com \
    --cc=mst@redhat.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=val@invisiblethingslab.com \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox