Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NsBDs-0000ue-63 for qemu-devel@nongnu.org; Thu, 18 Mar 2010 04:36:56 -0400 Received: from [199.232.76.173] (port=58444 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NsBDq-0000u6-GB for qemu-devel@nongnu.org; Thu, 18 Mar 2010 04:36:54 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NsBDo-0007kH-HU for qemu-devel@nongnu.org; Thu, 18 Mar 2010 04:36:54 -0400 Received: from mx20.gnu.org ([199.232.41.8]:15662) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NsBDn-0007jb-HI for qemu-devel@nongnu.org; Thu, 18 Mar 2010 04:36:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NsBDh-0001hw-4v for qemu-devel@nongnu.org; Thu, 18 Mar 2010 04:36:45 -0400 From: Markus Armbruster Subject: Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort() References: <20100316175523.GD19160@shareable.org> Date: Thu, 18 Mar 2010 09:36:34 +0100 In-Reply-To: <20100316175523.GD19160@shareable.org> (Jamie Lokier's message of "Tue, 16 Mar 2010 17:55:23 +0000") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jamie Lokier Cc: Paolo Bonzini , qemu-devel@nongnu.org Jamie Lokier writes: > Markus Armbruster wrote: >> Paolo Bonzini writes: >> >> > On 03/15/2010 07:36 PM, Markus Armbruster wrote: >> >> Please don't tell me that user emulators make abort() return. abort() >> >> is declared __noreturn__, and the optimizer may well rely on that. >> > >> > If the user programs make a "signal (SIGABRT, SIG_IGN)" call, I >> > suppose abort() will return. >> >> I program doing that gets what it asks for, and richly deserves. > > A guest program is also allowed to trap SIGABRT with a signal handler, > and that does have some uses. E.g. cleaning up temporary files and > shmem segments following a crash when calling 3rd party code. I'd expect such handler not to return, but SIG_DFL, clean up, then re-raise the signal. Regardless, a guest program can do whatever it pleases, and that includes the stupid as well as the clever. But the guest's doings should never unduly interfere with QEMU's use of signals. > Whatever the guest does with SIGABRT, it should not result in _QEMU_ > crashing - whether due to abort() returning, or QEMU's control flow > jumping to the guest's signal handler from an unexpected location. Agreed. The guest replacing one of QEMU's handlers with SIG_IGN or SIG_DFL would be "fun", too. No idea whether that's actually possible; I know next to nothing about user mode emulation.