[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACycT3vNOcuEZngDcUup=jugj-HJWUjSot5AkE5DYdBzPfzZZg@mail.gmail.com>
Date: Wed, 13 Oct 2021 20:59:12 +0800
From: Yongji Xie <xieyongji@...edance.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: Christoph Hellwig <hch@....de>, Jason Wang <jasowang@...hat.com>,
Stefan Hajnoczi <stefanha@...hat.com>,
virtualization <virtualization@...ts.linux-foundation.org>,
linux-block@...r.kernel.org,
linux-kernel <linux-kernel@...r.kernel.org>,
Kevin Wolf <kwolf@...hat.com>, Jens Axboe <axboe@...nel.dk>
Subject: Re: [PATCH v5] virtio-blk: Add validation for block size in config space
On Wed, Oct 13, 2021 at 8:51 PM Michael S. Tsirkin <mst@...hat.com> wrote:
>
> 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 <mst@...hat.com> 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 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 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'm pretty sure we want down that before. Let's just add a helper
> > > > just for that check for now as part of this series. Actually validating
> > > > in in blk_queue_logical_block_size seems like a good idea, but returning
> > > > errors from that has a long tail.
> > >
> > > Xie Yongji, I think I will revert this patch for now - can you
> > > please work out adding that helper and using it in virtio?
> > >
> >
> > Fine, I will do it.
> >
> > Thanks,
> > Yongji
>
> Great, thanks! And while at it, pls research a bit more and mention
> in the commit log what is the result of an illegal blk size?
> Is it memory corruption? A catastrophic failure?
> If it's one of these cases, then it's ok to just fail probe.
>
Sure, and I think it will be one of these cases. Will add some stack
dump in the commit log.
Thanks,
Yongji
Powered by blists - more mailing lists