* [PATCH v2] drm/virtio: do not enforce blob_alignment in cross-domain contexts
@ 2026-10-06 15:42 Val Packett
2026-10-08 7:33 ` Dmitry Osipenko
0 siblings, 1 reply; 2+ messages in thread
From: Val Packett @ 2026-10-06 15:42 UTC (permalink / raw)
To: David Airlie, Gerd Hoffmann, Dmitry Osipenko, Gurchetan Singh,
Chia-I Wu, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Simona Vetter, Sergio Lopez
Cc: Val Packett, dri-devel, virtualization, linux-kernel
VIRTIO_GPU_F_BLOB_ALIGNMENT is designed for GPU rendering context types,
however VIRTIO_GPU_CAPSET_CROSS_DOMAIN is not one of those. Resources
created under cross-domain contexts are arbitrary shared system memory
files, which includes unusual things like Wayland keymaps received
from the host compositor. Do not enforce alignment requirements there.
Fixes: 47248e0d8264 ("drm/virtio: honor blob_alignment requirements")
Signed-off-by: Val Packett <val@invisiblethingslab.com>
---
v2: also check has_virgl_3d to prevent dereferencing NULL vfpriv
v1: https://lore.kernel.org/all/20261006004044.2242154-1-val@invisiblethingslab.com/
~val
---
drivers/gpu/drm/virtio/virtgpu_ioctl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 3ddd5481d6bc..4d5ae062834d 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -551,7 +551,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;
--
2.55.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v2] drm/virtio: do not enforce blob_alignment in cross-domain contexts
2026-10-06 15:42 [PATCH v2] drm/virtio: do not enforce blob_alignment in cross-domain contexts Val Packett
@ 2026-10-08 7:33 ` Dmitry Osipenko
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Osipenko @ 2026-10-08 7:33 UTC (permalink / raw)
To: Val Packett, David Airlie, Gerd Hoffmann, Gurchetan Singh,
Chia-I Wu, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Simona Vetter, Sergio Lopez
Cc: dri-devel, virtualization, linux-kernel
On 10/6/26 18:42, Val Packett wrote:
> VIRTIO_GPU_F_BLOB_ALIGNMENT is designed for GPU rendering context types,
> however VIRTIO_GPU_CAPSET_CROSS_DOMAIN is not one of those. Resources
> created under cross-domain contexts are arbitrary shared system memory
> files, which includes unusual things like Wayland keymaps received
> from the host compositor. Do not enforce alignment requirements there.
>
> Fixes: 47248e0d8264 ("drm/virtio: honor blob_alignment requirements")
> Signed-off-by: Val Packett <val@invisiblethingslab.com>
> ---
>
> v2: also check has_virgl_3d to prevent dereferencing NULL vfpriv
> v1: https://lore.kernel.org/all/20261006004044.2242154-1-val@invisiblethingslab.com/
>
> ~val
>
> ---
> drivers/gpu/drm/virtio/virtgpu_ioctl.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> index 3ddd5481d6bc..4d5ae062834d 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> @@ -551,7 +551,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;
>
What userspace has this problem and why it re-purposes virtio-gpu to act
as udmabuf for arbitrary data that never reaches host?
--
Best regards,
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-08 7:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-06 15:42 [PATCH v2] drm/virtio: do not enforce blob_alignment in cross-domain contexts Val Packett
2026-10-08 7:33 ` Dmitry Osipenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®