qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] catch signals
Date: Wed, 06 Aug 2008 11:20:39 +0200	[thread overview]
Message-ID: <48996CE7.5010205@redhat.com> (raw)
In-Reply-To: <20080805163519.GV6570@redhat.com>

Daniel P. Berrange wrote:
> On Tue, Aug 05, 2008 at 06:09:39PM +0200, Gerd Hoffmann wrote:
>>  
>> +#ifndef _WIN32
>> +static void termsig_handler(int signal)
>> +{
>> +    switch (signal) {
>> +    case SIGSEGV:
>> +    case SIGBUS:
>> +        /* returning from signal handler most likely isn't going to work */
>> +        fprintf(stderr, "qemu: got signal %d (%s), taking emergency exit\n",
>> +                signal, strsignal(signal));
>> +        exit(1);
> 
> Neither of these functions are on the POSIX  async-signal-safe list,
> so their use from signal handlers is not a good idea.

We are in dead water already and also don't plan to ever return from the
 signal handler.  Is it really a problem then?

I want to be able to do cleanups (well, at least attempt) even in case
of a segfault.  If exit() + atexit handlers isn't going to fill the bill
we'll have to create some signal-save emergency cleanup handlers.

>> +        vm_start();	/* In case we're paused */
> 
> I think rather than trying todo anything in the signal handler,
> it is safest to just set a flag and have its state checked
> and acted upon in the main loop.

Isn't going to fly for SIGSEGV and SIGBUS.  Agree for the other signals.

I'll go check whenever we can handle stopped cpus some other way (guess
I just need an additional check in the main_loop() function).

cheers,
  Gerd

-- 
http://kraxel.fedorapeople.org/xenner/

  parent reply	other threads:[~2008-08-06  9:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-05 16:09 [Qemu-devel] [PATCH] catch signals Gerd Hoffmann
2008-08-05 16:29 ` Samuel Thibault
2008-08-06  9:11   ` Gerd Hoffmann
2008-08-05 16:35 ` Daniel P. Berrange
2008-08-05 16:53   ` Samuel Thibault
2008-08-05 17:00     ` Daniel P. Berrange
2008-08-05 18:39       ` Jamie Lokier
2008-08-06  9:20   ` Gerd Hoffmann [this message]
2008-08-06  9:48     ` Daniel P. Berrange
2008-08-11 16:50 ` Ian Jackson
2008-08-11 19:43   ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48996CE7.5010205@redhat.com \
    --to=kraxel@redhat.com \
    --cc=berrange@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).