qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 1/4] virtio: protect non-modern devices from too big virtq


From: Stefan Hajnoczi
Subject: Re: [PATCH v1 1/4] virtio: protect non-modern devices from too big virtqueue size setting
Date: Wed, 6 Nov 2019 10:18:12 +0100
User-agent: Mutt/1.12.1 (2019-06-15)

On Tue, Nov 05, 2019 at 03:56:43PM -0500, Michael S. Tsirkin wrote:
> On Tue, Nov 05, 2019 at 07:11:02PM +0300, Denis Plotnikov wrote:
> > @@ -47,6 +48,15 @@ static void virtio_scsi_pci_realize(VirtIOPCIProxy 
> > *vpci_dev, Error **errp)
> >      VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(vdev);
> >      DeviceState *proxy = DEVICE(vpci_dev);
> >      char *bus_name;
> > +    bool modern = virtio_pci_modern(vpci_dev);
> > +    uint32_t virtqueue_size = vs->conf.virtqueue_size;
> > +
> > +    if (!modern && virtqueue_size > 128) {
> > +        error_setg(errp,
> > +                   "too big virtqueue size (%u, max: 128) "
> > +                   "for non-modern virtio device", virtqueue_size);
> > +        return;
> > +    }
> 
> why? what is illegal about 256 for legacy?

I think it was mentioned that this limit is specific to SeaBIOS
src/hw/virtio-pci.c:vp_find_vq():

  #define MAX_QUEUE_NUM      (128)
  ...
  if (num > MAX_QUEUE_NUM) {
      dprintf(1, "ERROR: queue size %d > %d\n", num, MAX_QUEUE_NUM);
      goto fail;
  }

I'm not sure there is anything we can do in QEMU.  Either you can let
SeaBIOS fail, or if you want something more user-friendly, then the
management tool can implement a check based on the SeaBIOS version and
the -device virtio-blk-pci,queue-size=SIZE property value.

Stefan

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]