Re: [PATCH] virtio: refresh vring region cache after updating a virtqueue size

2023-03-15 Thread Cornelia Huck
On Mon, Mar 13 2023, Carlos López wrote: > On 9/3/23 11:43, Cornelia Huck wrote: >> On Thu, Mar 02 2023, Carlos López wrote: >>> Fix this by calling virtio_queue_update_rings() after >>> virtio_queue_set_num() if we are not already calling >>> virtio_queue_set_rings(). >> >> Don't we instead ne

Re: [PATCH] virtio: refresh vring region cache after updating a virtqueue size

2023-03-13 Thread Carlos López
On 9/3/23 11:43, Cornelia Huck wrote: On Thu, Mar 02 2023, Carlos López wrote: Fix this by calling virtio_queue_update_rings() after virtio_queue_set_num() if we are not already calling virtio_queue_set_rings(). Don't we instead need to call virtio_init_region_cache() to update the caches? vi

Re: [PATCH] virtio: refresh vring region cache after updating a virtqueue size

2023-03-10 Thread Michael S. Tsirkin
On Thu, Mar 09, 2023 at 11:43:46AM +0100, Cornelia Huck wrote: > On Thu, Mar 02 2023, Carlos López wrote: > > > When a virtqueue size is changed by the guest via > > virtio_queue_set_num(), its region cache is not automatically updated. > > If the size was increased, this could lead to accessing

Re: [PATCH] virtio: refresh vring region cache after updating a virtqueue size

2023-03-09 Thread Cornelia Huck
On Thu, Mar 02 2023, Carlos López wrote: > When a virtqueue size is changed by the guest via > virtio_queue_set_num(), its region cache is not automatically updated. > If the size was increased, this could lead to accessing the cache out > of bounds. For example, in vring_get_used_event(): > >

Re: [PATCH] virtio: refresh vring region cache after updating a virtqueue size

2023-03-06 Thread Thomas Huth
On 02/03/2023 11.14, Carlos López wrote: When a virtqueue size is changed by the guest via virtio_queue_set_num(), its region cache is not automatically updated. If the size was increased, this could lead to accessing the cache out of bounds. For example, in vring_get_used_event(): static i

[PATCH] virtio: refresh vring region cache after updating a virtqueue size

2023-03-02 Thread Carlos López
When a virtqueue size is changed by the guest via virtio_queue_set_num(), its region cache is not automatically updated. If the size was increased, this could lead to accessing the cache out of bounds. For example, in vring_get_used_event(): static inline uint16_t vring_get_used_event(VirtQueu