From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFhkj-0008RF-Pb for qemu-devel@nongnu.org; Tue, 18 Feb 2014 05:18:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFhkg-0002JK-0e for qemu-devel@nongnu.org; Tue, 18 Feb 2014 05:18:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:11458) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFhkf-0002JC-Oq for qemu-devel@nongnu.org; Tue, 18 Feb 2014 05:18:09 -0500 Date: Tue, 18 Feb 2014 10:17:59 +0000 From: "Daniel P. Berrange" Message-ID: <20140218101759.GC32645@redhat.com> References: <1392651898-16749-1-git-send-email-stefanha@redhat.com> <1392651898-16749-4-git-send-email-stefanha@redhat.com> <530235F0.2040406@redhat.com> <87a9dpsmi4.fsf@blackfin.pond.sub.org> <20140218090504.GB32585@stefanha-thinkpad.redhat.com> <530330F9.5070608@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <530330F9.5070608@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/3] qtest: kill QEMU process on g_assert() failure Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Peter Maydell , Stefan Hajnoczi , Stefan Hajnoczi , qemu-devel@nongnu.org, Markus Armbruster , Anthony Liguori , Andreas Faerber On Tue, Feb 18, 2014 at 11:07:53AM +0100, Paolo Bonzini wrote: > Il 18/02/2014 10:05, Stefan Hajnoczi ha scritto: > >>> SIGABRT is normally synchronous enough: it's sent by abort(). But of > >>> course, nothing stops the user from kill -ABRT. Or GLib from calling > >>> abort() in some place where an attempt to reenter it crashes & burns. > >>> Not sure I'd care, but I'm pretty sure I don't care for freeing stuff on > >>> exit :) > >Yes, SIGABRT is synchronous for all purposes. So the only danger is > >that g_string_free() or g_free() could fail while we're in > >g_assert(false). But they don't, which makes sense because they are > >totally unrelated to g_assert() and therefore can handle re-entrancy. > > If malloc aborts due to a double free or other similar problem, you > may risk reentering it. If you register the custom SIGABRT handler with sigaction + SA_RESETHAND then you'd avoid the re-entrancy risk, since a cascading SIGABRT would get handled by the system default handler, which would immediately terminate the process. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|