Received: from eggs.gnu.org ([2001:4830:134:3::10]:45579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIITR-0001mc-Nr for qemu-devel@nongnu.org; Wed, 29 Jun 2016 12:36:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bIITO-0007xH-BD for qemu-devel@nongnu.org; Wed, 29 Jun 2016 12:36:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53012) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIITO-0007wu-50 for qemu-devel@nongnu.org; Wed, 29 Jun 2016 12:36:22 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D83617F6A8 for ; Wed, 29 Jun 2016 16:36:20 +0000 (UTC) Date: Wed, 29 Jun 2016 18:36:12 +0200 From: Igor Mammedov Message-ID: <20160629183612.45733386@igors-macbook-pro.local> In-Reply-To: <87vb0sw45k.fsf@dusky.pond.sub.org> References: <1467102269-11112-1-git-send-email-imammedo@redhat.com> <87vb0sw45k.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] virtio: abort on fatal error instead of just exiting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, mst@redhat.com On Wed, 29 Jun 2016 14:49:59 +0200 Markus Armbruster wrote: > Igor Mammedov writes: > > > replace mainly useless exit(1) on fatal error path with > > abort(), so that it would be possible to generate core > > dump, that could be used to analyse cause of problem. > > > > Signed-off-by: Igor Mammedov > > --- > > hw/virtio/virtio.c | 24 ++++++++++++------------ > > 1 file changed, 12 insertions(+), 12 deletions(-) > > > > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c > > index 7ed06ea..9d3ac72 100644 > > --- a/hw/virtio/virtio.c > > +++ b/hw/virtio/virtio.c > > @@ -315,7 +315,7 @@ static int virtqueue_num_heads(VirtQueue *vq, > > unsigned int idx) if (num_heads > vq->vring.num) { > > error_report("Guest moved used index from %u to %u", > > idx, vq->shadow_avail_idx); > > - exit(1); > > + abort(); > > What's wrong with a simple assert(num_heads <= vq->vring.num)? Nothing, it should work to as we don't use NDEBUG. My intent was to make core dump at the point and no to remove error message (though message's mostly useless for me as virtio is unfamiliar to me and I had to dig into core dump to analyze issue). > > > } > > /* On success, callers read a descriptor at vq->last_avail_idx. > > * Make sure descriptor read does not bypass avail index read. > > */ > [...]