From: Marcelo Tosatti <mtosatti@redhat.com>
To: Jean-Christophe Dubois <jcd@tribudubois.net>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Fix NULL alarm_timer pointer at exit
Date: Wed, 20 May 2009 16:08:35 -0300 [thread overview]
Message-ID: <20090520190835.GA28898@amt.cnet> (raw)
In-Reply-To: <200905171838.40006.jcd@tribudubois.net>
Hi,
I think the right fix is to block SIGALRM in quit_timers, which
is called from main():
static void quit_timers(void)
{
alarm_timer->stop(alarm_timer);
alarm_timer = NULL;
}
On Sun, May 17, 2009 at 06:38:39PM +0200, Jean-Christophe Dubois wrote:
> This fixes a SIGSEGV error on qemu exit.
>
> Here is the valgrind output related to this error
>
> ==3648== Process terminating with default action of signal 11 (SIGSEGV)
> ==3648== Access not within mapped region at address 0x8
> ==3648== at 0x40636B: host_alarm_handler (vl.c:1345)
> ==3648== by 0x52D807F: (within /lib/libpthread-2.9.so)
> ==3648== by 0x5C0A12E: tcsetattr (in /lib/libc-2.9.so)
> ==3648== by 0x4DD601: term_exit (qemu-char.c:700)
> ==3648== by 0x5B636EC: exit (in /lib/libc-2.9.so)
> ==3648== by 0x5B4B5AC: (below main) (in /lib/libc-2.9.so)
>
> This simple fix check for a valid pointer as host_alarm_handler is
> also called after alarm_timer is released in the exit path.
>
> Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
>
> --- qemu.org/vl.c 2009-05-16 17:57:27.000000000 +0200
> +++ qemu/vl.c 2009-05-17 17:15:29.000000000 +0200
> @@ -915,7 +915,7 @@
>
> static inline int alarm_has_dynticks(struct qemu_alarm_timer *t)
> {
> - return t->flags & ALARM_FLAG_DYNTICKS;
> + return t && (t->flags & ALARM_FLAG_DYNTICKS);
> }
>
> static void qemu_rearm_alarm_timer(struct qemu_alarm_timer *t)
> @@ -1349,7 +1349,7 @@
> qemu_timer_expired(active_timers[QEMU_TIMER_REALTIME],
> qemu_get_clock(rt_clock))) {
> qemu_event_increment();
> - alarm_timer->flags |= ALARM_FLAG_EXPIRED;
> + if (alarm_timer) alarm_timer->flags |= ALARM_FLAG_EXPIRED;
>
> #ifndef CONFIG_IOTHREAD
> if (next_cpu) {
>
>
prev parent reply other threads:[~2009-05-20 19:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-17 16:38 [Qemu-devel] [PATCH] Fix NULL alarm_timer pointer at exit Jean-Christophe Dubois
2009-05-20 19:08 ` Marcelo Tosatti [this message]
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=20090520190835.GA28898@amt.cnet \
--to=mtosatti@redhat.com \
--cc=jcd@tribudubois.net \
--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).