Received: from eggs.gnu.org ([2001:4830:134:3::10]:47705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akoRs-00054v-Oe for qemu-devel@nongnu.org; Tue, 29 Mar 2016 03:52:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1akoRn-0001Cc-NY for qemu-devel@nongnu.org; Tue, 29 Mar 2016 03:52:24 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:33931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akoRn-0001CD-6t for qemu-devel@nongnu.org; Tue, 29 Mar 2016 03:52:19 -0400 Received: from localhost by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 29 Mar 2016 08:52:16 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id C62E817D805F for ; Tue, 29 Mar 2016 08:52:50 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u2T7qDsc6947244 for ; Tue, 29 Mar 2016 07:52:13 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u2T7qDWE005609 for ; Tue, 29 Mar 2016 01:52:13 -0600 Date: Tue, 29 Mar 2016 09:52:11 +0200 From: Cornelia Huck Message-ID: <20160329095211.51057354.cornelia.huck@de.ibm.com> In-Reply-To: <1458842214-11450-3-git-send-email-stefanha@redhat.com> References: <1458842214-11450-1-git-send-email-stefanha@redhat.com> <1458842214-11450-3-git-send-email-stefanha@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC 2/7] virtio: stop virtqueue processing if device is broken List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Fam Zheng , qemu-devel@nongnu.org, "Michael S. Tsirkin" On Thu, 24 Mar 2016 17:56:49 +0000 Stefan Hajnoczi wrote: > QEMU prints an error message and exits when the device enters an invalid > state. Terminating the process is heavy-handed. The guest may still be > able to function even if there is a bug in a virtio guest driver. > > Moreover, exiting is a bug in nested virtualization where a nested guest > could DoS other nested guests by killing a pass-through virtio device. > I don't think this configuration is possible today but it is likely in > the future. > > If the broken flag is set, do not process virtqueues or write back used > descriptors. The broken flag can be cleared again by resetting the > device. > > Signed-off-by: Stefan Hajnoczi > --- > hw/virtio/virtio.c | 34 ++++++++++++++++++++++++++++++++++ > include/hw/virtio/virtio.h | 3 +++ > 2 files changed, 37 insertions(+) > +void GCC_FMT_ATTR(2, 3) virtio_error(VirtIODevice *vdev, const char *fmt, ...) > +{ > + va_list ap; > + > + va_start(ap, fmt); > + error_vreport(fmt, ap); > + va_end(ap); > + > + vdev->broken = true; We should set the NEEDS_RESET status flag for virtio-1 devices here, I think. > +} > +