Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-24 Thread Jason Wang
On Wed, Nov 24, 2021 at 7:33 PM Halil Pasic wrote: > > On Wed, 24 Nov 2021 10:33:28 +0800 > Jason Wang wrote: > > > > > > Let's see how far we can get. But yes, maybe we were too aggressive in > > > > > breaking things by default, a warning might be a better choice for a > > > > > couple of cycle

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-24 Thread Halil Pasic
On Wed, 24 Nov 2021 10:33:28 +0800 Jason Wang wrote: > > > > Let's see how far we can get. But yes, maybe we were too aggressive in > > > > breaking things by default, a warning might be a better choice for a > > > > couple of cycles. > > > > Ok, considering we saw the issues with balloons I th

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-24 Thread Jason Wang
On Wed, Nov 24, 2021 at 4:24 PM Michael S. Tsirkin wrote: > > On Wed, Nov 24, 2021 at 03:59:12PM +0800, Jason Wang wrote: > > On Wed, Nov 24, 2021 at 3:22 PM Michael S. Tsirkin wrote: > > > > > > On Wed, Nov 24, 2021 at 10:33:28AM +0800, Jason Wang wrote: > > > > On Wed, Nov 24, 2021 at 10:26 AM

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-24 Thread Michael S. Tsirkin
On Wed, Nov 24, 2021 at 03:59:12PM +0800, Jason Wang wrote: > On Wed, Nov 24, 2021 at 3:22 PM Michael S. Tsirkin wrote: > > > > On Wed, Nov 24, 2021 at 10:33:28AM +0800, Jason Wang wrote: > > > On Wed, Nov 24, 2021 at 10:26 AM Jason Wang wrote: > > > > > > > > On Wed, Nov 24, 2021 at 9:30 AM Mich

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-23 Thread Jason Wang
On Wed, Nov 24, 2021 at 3:22 PM Michael S. Tsirkin wrote: > > On Wed, Nov 24, 2021 at 10:33:28AM +0800, Jason Wang wrote: > > On Wed, Nov 24, 2021 at 10:26 AM Jason Wang wrote: > > > > > > On Wed, Nov 24, 2021 at 9:30 AM Michael Ellerman > > > wrote: > > > > > > > > "Michael S. Tsirkin" writes

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-23 Thread Michael S. Tsirkin
On Wed, Nov 24, 2021 at 10:33:28AM +0800, Jason Wang wrote: > On Wed, Nov 24, 2021 at 10:26 AM Jason Wang wrote: > > > > On Wed, Nov 24, 2021 at 9:30 AM Michael Ellerman > > wrote: > > > > > > "Michael S. Tsirkin" writes: > > > > On Tue, Nov 23, 2021 at 10:25:20AM +0800, Jason Wang wrote: > > >

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-23 Thread Jason Wang
On Wed, Nov 24, 2021 at 10:26 AM Jason Wang wrote: > > On Wed, Nov 24, 2021 at 9:30 AM Michael Ellerman wrote: > > > > "Michael S. Tsirkin" writes: > > > On Tue, Nov 23, 2021 at 10:25:20AM +0800, Jason Wang wrote: > > >> On Tue, Nov 23, 2021 at 4:24 AM Halil Pasic wrote: > > >> > > > >> > On Mo

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-23 Thread Jason Wang
On Wed, Nov 24, 2021 at 9:30 AM Michael Ellerman wrote: > > "Michael S. Tsirkin" writes: > > On Tue, Nov 23, 2021 at 10:25:20AM +0800, Jason Wang wrote: > >> On Tue, Nov 23, 2021 at 4:24 AM Halil Pasic wrote: > >> > > >> > On Mon, 22 Nov 2021 14:25:26 +0800 > >> > Jason Wang wrote: > >> > > >>

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-23 Thread Michael Ellerman
"Michael S. Tsirkin" writes: > On Tue, Nov 23, 2021 at 10:25:20AM +0800, Jason Wang wrote: >> On Tue, Nov 23, 2021 at 4:24 AM Halil Pasic wrote: >> > >> > On Mon, 22 Nov 2021 14:25:26 +0800 >> > Jason Wang wrote: >> > >> > > I think the fixes are: >> > > >> > > 1) fixing the vhost vsock >> > > 2

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-23 Thread Halil Pasic
On Tue, 23 Nov 2021 07:17:05 -0500 "Michael S. Tsirkin" wrote: > On Mon, Nov 22, 2021 at 02:50:03PM +0100, Halil Pasic wrote: > > On Mon, 22 Nov 2021 14:25:26 +0800 > > Jason Wang wrote: > > > > > On Mon, Nov 22, 2021 at 1:49 PM Halil Pasic wrote: > > > > > > > > On Mon, 22 Nov 2021 06:35:

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-23 Thread Michael S. Tsirkin
On Mon, Nov 22, 2021 at 02:50:03PM +0100, Halil Pasic wrote: > On Mon, 22 Nov 2021 14:25:26 +0800 > Jason Wang wrote: > > > On Mon, Nov 22, 2021 at 1:49 PM Halil Pasic wrote: > > > > > > On Mon, 22 Nov 2021 06:35:18 +0100 > > > Halil Pasic wrote: > > > > > > > > I think it should be a common

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-23 Thread Michael S. Tsirkin
On Tue, Nov 23, 2021 at 10:25:20AM +0800, Jason Wang wrote: > On Tue, Nov 23, 2021 at 4:24 AM Halil Pasic wrote: > > > > On Mon, 22 Nov 2021 14:25:26 +0800 > > Jason Wang wrote: > > > > > I think the fixes are: > > > > > > 1) fixing the vhost vsock > > > 2) use suppress_used_validation=true to le

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-22 Thread Jason Wang
On Mon, Nov 22, 2021 at 9:50 PM Halil Pasic wrote: > > On Mon, 22 Nov 2021 14:25:26 +0800 > Jason Wang wrote: > > > On Mon, Nov 22, 2021 at 1:49 PM Halil Pasic wrote: > > > > > > On Mon, 22 Nov 2021 06:35:18 +0100 > > > Halil Pasic wrote: > > > > > > > > I think it should be a common issue, loo

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-22 Thread Jason Wang
On Tue, Nov 23, 2021 at 4:24 AM Halil Pasic wrote: > > On Mon, 22 Nov 2021 14:25:26 +0800 > Jason Wang wrote: > > > I think the fixes are: > > > > 1) fixing the vhost vsock > > 2) use suppress_used_validation=true to let vsock driver to validate > > the in buffer length > > 3) probably a new feat

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-22 Thread Halil Pasic
On Mon, 22 Nov 2021 14:25:26 +0800 Jason Wang wrote: > I think the fixes are: > > 1) fixing the vhost vsock > 2) use suppress_used_validation=true to let vsock driver to validate > the in buffer length > 3) probably a new feature so the driver can only enable the validation > when the feature is

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-22 Thread Stefano Garzarella
On Mon, Nov 22, 2021 at 03:24:32PM +0100, Halil Pasic wrote: On Mon, 22 Nov 2021 12:08:22 +0100 Stefano Garzarella wrote: On Mon, Nov 22, 2021 at 08:55:24AM +0100, Stefano Garzarella wrote: >On Mon, Nov 22, 2021 at 02:25:26PM +0800, Jason Wang wrote: >>On Mon, Nov 22, 2021 at 1:49 PM Halil Pas

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-22 Thread Halil Pasic
On Mon, 22 Nov 2021 12:08:22 +0100 Stefano Garzarella wrote: > On Mon, Nov 22, 2021 at 08:55:24AM +0100, Stefano Garzarella wrote: > >On Mon, Nov 22, 2021 at 02:25:26PM +0800, Jason Wang wrote: > >>On Mon, Nov 22, 2021 at 1:49 PM Halil Pasic wrote: > >>> > >>>On Mon, 22 Nov 2021 06:35:18 +01

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-22 Thread Halil Pasic
On Mon, 22 Nov 2021 14:25:26 +0800 Jason Wang wrote: > On Mon, Nov 22, 2021 at 1:49 PM Halil Pasic wrote: > > > > On Mon, 22 Nov 2021 06:35:18 +0100 > > Halil Pasic wrote: > > > > > > I think it should be a common issue, looking at > > > > vhost_vsock_handle_tx_kick(), it did: > > > > > > > >

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-22 Thread Stefano Garzarella
On Mon, Nov 22, 2021 at 08:55:24AM +0100, Stefano Garzarella wrote: On Mon, Nov 22, 2021 at 02:25:26PM +0800, Jason Wang wrote: On Mon, Nov 22, 2021 at 1:49 PM Halil Pasic wrote: On Mon, 22 Nov 2021 06:35:18 +0100 Halil Pasic wrote: > I think it should be a common issue, looking at > vhost

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-21 Thread Stefano Garzarella
On Mon, Nov 22, 2021 at 02:25:26PM +0800, Jason Wang wrote: On Mon, Nov 22, 2021 at 1:49 PM Halil Pasic wrote: On Mon, 22 Nov 2021 06:35:18 +0100 Halil Pasic wrote: > > I think it should be a common issue, looking at > > vhost_vsock_handle_tx_kick(), it did: > > > > len += sizeof(pkt->hdr);

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-21 Thread Stefano Garzarella
On Mon, Nov 22, 2021 at 11:51:09AM +0800, Jason Wang wrote: On Fri, Nov 19, 2021 at 11:10 PM Halil Pasic wrote: On Wed, 27 Oct 2021 10:21:04 +0800 Jason Wang wrote: > This patch validate the used buffer length provided by the device > before trying to use it. This is done by record the in bu

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-21 Thread Jason Wang
On Mon, Nov 22, 2021 at 1:49 PM Halil Pasic wrote: > > On Mon, 22 Nov 2021 06:35:18 +0100 > Halil Pasic wrote: > > > > I think it should be a common issue, looking at > > > vhost_vsock_handle_tx_kick(), it did: > > > > > > len += sizeof(pkt->hdr); > > > vhost_add_used(vq, head, len); > > > > > >

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-21 Thread Halil Pasic
On Mon, 22 Nov 2021 06:35:18 +0100 Halil Pasic wrote: > > I think it should be a common issue, looking at > > vhost_vsock_handle_tx_kick(), it did: > > > > len += sizeof(pkt->hdr); > > vhost_add_used(vq, head, len); > > > > which looks like a violation of the spec since it's TX. > > I'm not

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-21 Thread Halil Pasic
On Mon, 22 Nov 2021 11:51:09 +0800 Jason Wang wrote: > On Fri, Nov 19, 2021 at 11:10 PM Halil Pasic wrote: > > > > On Wed, 27 Oct 2021 10:21:04 +0800 > > Jason Wang wrote: > > > > > This patch validate the used buffer length provided by the device > > > before trying to use it. This is done b

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-21 Thread Jason Wang
On Fri, Nov 19, 2021 at 11:10 PM Halil Pasic wrote: > > On Wed, 27 Oct 2021 10:21:04 +0800 > Jason Wang wrote: > > > This patch validate the used buffer length provided by the device > > before trying to use it. This is done by record the in buffer length > > in a new field in desc_state structur

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-19 Thread Halil Pasic
On Wed, 27 Oct 2021 10:21:04 +0800 Jason Wang wrote: > This patch validate the used buffer length provided by the device > before trying to use it. This is done by record the in buffer length > in a new field in desc_state structure during virtqueue_add(), then we > can fail the virtqueue_get_buf

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-01 Thread Jason Wang
On Tue, Nov 2, 2021 at 11:22 AM Xuan Zhuo wrote: > > On Wed, 27 Oct 2021 10:21:04 +0800, Jason Wang wrote: > > This patch validate the used buffer length provided by the device > > before trying to use it. This is done by record the in buffer length > > in a new field in desc_state structure duri

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-01 Thread Xuan Zhuo
On Wed, 27 Oct 2021 10:21:04 +0800, Jason Wang wrote: > This patch validate the used buffer length provided by the device > before trying to use it. This is done by record the in buffer length > in a new field in desc_state structure during virtqueue_add(), then we > can fail the virtqueue_get_buf

[PATCH V5 1/4] virtio_ring: validate used buffer length

2021-10-26 Thread Jason Wang
This patch validate the used buffer length provided by the device before trying to use it. This is done by record the in buffer length in a new field in desc_state structure during virtqueue_add(), then we can fail the virtqueue_get_buf() when we find the device is trying to give us a used buffer l