lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250807084310-mutt-send-email-mst@kernel.org>
Date: Thu, 7 Aug 2025 08:45:56 -0400
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Igor Torrente <igor.torrente@...labora.com>
Cc: sami.md.ko@...il.com, virtualization@...ts.linux.dev,
	linux-kernel@...r.kernel.org, eperezma@...hat.com,
	xuanzhuo@...ux.alibaba.com, jasowang@...hat.com,
	dmitry.osipenko@...labora.com
Subject: Re: [PATCH] Revert "virtio: reject shm region if length is zero"

On Thu, Aug 07, 2025 at 09:41:45AM -0300, Igor Torrente wrote:
> This reverts commit 206cc44588f72b49ad4d7e21a7472ab2a72a83df.
> 

No that's not enough. Explain the why not the what.
for example

-------


The commit 206cc44588f7 ("virtio: reject shm region if length is zero")
breaks the Virtio-gpu `host_visible` feature.

As you can see in the snippet below, host_visible_region is zero because
of the `kzalloc`.  It's using the `vm_get_shm_region`
(drivers/virtio/virtio_mmio.c:536) to read the `addr` and `len` from
qemu/crosvm.

```
drivers/gpu/drm/virtio/virtgpu_kms.c
132         vgdev = drmm_kzalloc(dev, sizeof(struct virtio_gpu_device), GFP_KERNEL);
[...]
177         if (virtio_get_shm_region(vgdev->vdev, &vgdev->host_visible_region,
178                                   VIRTIO_GPU_SHM_ID_HOST_VISIBLE)) {
```
Now it always fails.

To fix, revert the offending commit.

Fixes: 206cc44588f7 ("virtio: reject shm region if length is zero` breaks the Virtio-gpu `host_visible")

-------

> Signed-off-by: Igor Torrente <igor.torrente@...labora.com>


> ---
>  include/linux/virtio_config.h | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
> index b3e1d30c765b..169c7d367fac 100644
> --- a/include/linux/virtio_config.h
> +++ b/include/linux/virtio_config.h
> @@ -329,8 +329,6 @@ static inline
>  bool virtio_get_shm_region(struct virtio_device *vdev,
>  			   struct virtio_shm_region *region, u8 id)
>  {
> -	if (!region->len)
> -		return false;
>  	if (!vdev->config->get_shm_region)
>  		return false;
>  	return vdev->config->get_shm_region(vdev, region, id);
> -- 
> 2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ