Re: [PATCH v5] virtio-blk: Add validation for block size in config space

2021-10-13 Thread Michael S. Tsirkin
On Wed, Oct 13, 2021 at 08:34:22PM +0800, Yongji Xie wrote: > On Wed, Oct 13, 2021 at 8:21 PM Michael S. Tsirkin wrote: > > > > On Mon, Oct 11, 2021 at 01:40:41PM +0200, Christoph Hellwig wrote: > > > On Tue, Oct 05, 2021 at 06:42:43AM -0400, Michael S. Tsirkin wrote: > > > > Stefan also pointed

Re: [PATCH v5] virtio-blk: Add validation for block size in config space

2021-10-13 Thread Michael S. Tsirkin
On Mon, Oct 11, 2021 at 01:40:41PM +0200, Christoph Hellwig wrote: > On Tue, Oct 05, 2021 at 06:42:43AM -0400, Michael S. Tsirkin wrote: > > Stefan also pointed out this duplicates the logic from > > > > if (blksize < 512 || blksize > PAGE_SIZE || !is_power_of_2(blksize)) > >

Re: [PATCH v5] virtio-blk: Add validation for block size in config space

2021-10-11 Thread Christoph Hellwig
On Tue, Oct 05, 2021 at 06:42:43AM -0400, Michael S. Tsirkin wrote: > Stefan also pointed out this duplicates the logic from > > if (blksize < 512 || blksize > PAGE_SIZE || !is_power_of_2(blksize)) > return -EINVAL; > > > and a bunch of other places. > > > Would it be

Re: [PATCH v5] virtio-blk: Add validation for block size in config space

2021-10-05 Thread Martin K. Petersen
Michael, > Would it be acceptable for blk layer to validate the input instead of > having each driver do it's own thing? Maybe inside > blk_queue_logical_block_size? I think that would be fine. I believe we had some patches floating around a few years ago attempting to make that change. --

Re: [PATCH v5] virtio-blk: Add validation for block size in config space

2021-10-05 Thread Michael S. Tsirkin
On Mon, Oct 04, 2021 at 11:27:29AM -0400, Michael S. Tsirkin wrote: > On Mon, Aug 09, 2021 at 06:16:09PM +0800, Xie Yongji wrote: > > An untrusted device might presents an invalid block size > > in configuration space. This tries to add validation for it > > in the validate callback and clear the

Re: [PATCH v5] virtio-blk: Add validation for block size in config space

2021-10-04 Thread Michael S. Tsirkin
On Mon, Oct 04, 2021 at 11:27:29AM -0400, Michael S. Tsirkin wrote: > On Mon, Aug 09, 2021 at 06:16:09PM +0800, Xie Yongji wrote: > > An untrusted device might presents an invalid block size > > in configuration space. This tries to add validation for it > > in the validate callback and clear the

Re: [PATCH v5] virtio-blk: Add validation for block size in config space

2021-10-04 Thread Michael S. Tsirkin
On Mon, Aug 09, 2021 at 06:16:09PM +0800, Xie Yongji wrote: > An untrusted device might presents an invalid block size > in configuration space. This tries to add validation for it > in the validate callback and clear the VIRTIO_BLK_F_BLK_SIZE > feature bit if the value is out of the supported

Re: [PATCH v5] virtio-blk: Add validation for block size in config space

2021-08-23 Thread Jason Wang
On Tue, Aug 24, 2021 at 6:31 AM Max Gurtovoy wrote: > > > On 8/23/2021 3:13 PM, Michael S. Tsirkin wrote: > > On Mon, Aug 23, 2021 at 01:45:31PM +0300, Max Gurtovoy wrote: > >> It helpful if there is a justification for this. > >> > >> In this case, no such HW device exist and the only device

Re: [PATCH v5] virtio-blk: Add validation for block size in config space

2021-08-23 Thread Michael S. Tsirkin
On Mon, Aug 23, 2021 at 08:40:30PM +0800, Yongji Xie wrote: > On Mon, Aug 23, 2021 at 8:13 PM Michael S. Tsirkin wrote: > > > > On Mon, Aug 23, 2021 at 01:45:31PM +0300, Max Gurtovoy wrote: > > > It helpful if there is a justification for this. > > > > > > In this case, no such HW device exist

Re: [PATCH v5] virtio-blk: Add validation for block size in config space

2021-08-23 Thread Michael S. Tsirkin
On Mon, Aug 23, 2021 at 01:45:31PM +0300, Max Gurtovoy wrote: > It helpful if there is a justification for this. > > In this case, no such HW device exist and the only device that can cause > this trouble today is user space VDUSE device that must be validated by the > emulation VDUSE kernel

Re: [PATCH v5] virtio-blk: Add validation for block size in config space

2021-08-10 Thread Jason Wang
在 2021/8/10 下午12:59, Yongji Xie 写道: On Tue, Aug 10, 2021 at 11:05 AM Jason Wang wrote: 在 2021/8/9 下午6:16, Xie Yongji 写道: An untrusted device might presents an invalid block size in configuration space. This tries to add validation for it in the validate callback and clear the

Re: [PATCH v5] virtio-blk: Add validation for block size in config space

2021-08-09 Thread Jason Wang
在 2021/8/9 下午6:16, Xie Yongji 写道: An untrusted device might presents an invalid block size in configuration space. This tries to add validation for it in the validate callback and clear the VIRTIO_BLK_F_BLK_SIZE feature bit if the value is out of the supported range. And we also double check