From: "Daniel P. Berrange" <berrange@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] report that QEMU process was killed by a signal
Date: Mon, 14 Mar 2011 13:07:40 +0000 [thread overview]
Message-ID: <20110314130740.GC23458@redhat.com> (raw)
In-Reply-To: <20110314125855.GP10151@redhat.com>
On Mon, Mar 14, 2011 at 02:58:55PM +0200, Gleb Natapov wrote:
> Currently when rogue script kills QEMU process (using TERM/INT/HUP
> signal) it looks indistinguishable from system shutdown. Lets report
> that QMEU was killed and leave some clues about the killed identity.
Good idea, but....
>
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> diff --git a/os-posix.c b/os-posix.c
> index 38c29d1..7e175e8 100644
> --- a/os-posix.c
> +++ b/os-posix.c
> @@ -61,8 +61,9 @@ void os_setup_early_signal_handling(void)
> sigaction(SIGPIPE, &act, NULL);
> }
>
> -static void termsig_handler(int signal)
> +static void termsig_handler(int signal, siginfo_t *info, void *c)
> {
> + fprintf(stderr, "Got signal %d from pid %d\n", info->si_signo, info->si_pid);
> qemu_system_shutdown_request();
...fprintf() isn't async signal safe. It could deadlock the process
if it malloc()s while doing the arg formatting & the interrupted
thread was already holding a malloc() lock, or indeed if the stdio
impl itself has internal locks which are held. So this data needs
to be manually output using just write()
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 :|
next prev parent reply other threads:[~2011-03-14 13:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-14 12:58 [Qemu-devel] [PATCH] report that QEMU process was killed by a signal Gleb Natapov
2011-03-14 13:07 ` Daniel P. Berrange [this message]
2011-03-14 13:11 ` Gleb Natapov
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=20110314130740.GC23458@redhat.com \
--to=berrange@redhat.com \
--cc=gleb@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).