From: Luiz Capitulino <lcapitulino@redhat.com>
To: jan.kiszka@siemens.com
Cc: qemu-devel@nongnu.org, lirans@il.ibm.com
Subject: [Qemu-devel] [STAGING]: Block migration segfaults
Date: Thu, 3 Dec 2009 16:21:21 -0200 [thread overview]
Message-ID: <20091203162121.67d9c120@doriath> (raw)
Hi there,
Got this while testing block migration in staging:
"""
Program terminated with signal 11, Segmentation fault.
#0 0x0000000000410cf9 in monitor_vprintf (mon=0x0, fmt=0x5ae5e7 "Start full migration for %s\n",
ap=0x7fff1f830a40) at /home/lcapitulino/src/aliguori-queue/monitor.c:192
192 if (mon->mc && !mon->mc->print_enabled) {
"""
The problem here is that init_blk_migration() calls monitor_printf() with
a NULL 'mon' and the backtrace shows that this is true for the entire call
chain.
You probably didn't note it before because the lowest-level monitor
print function would just return if the 'mon' parameter was NULL.
A patch from me (4a29a in staging) changes a higher level monitor
function to touch 'mon' before passing it down and here's the segfault.
Now, the point is: I could give the old behavior back but I think we're
hiding a bug there. Why would you call monitor_printf() with a NULL 'mon'?
Anyways, the following patch adds the old behavior back just in case
you want to see it working...
commit 3575196202d4e54c1fc63a631ca5bd1a7778e30d
Author: Luiz Capitulino <lcapitulino@redhat.com>
Date: Thu Dec 3 15:49:16 2009 -0200
monitor: Fix block migration segfault
The monitor_vprintf() function now touches the 'mon' variable
before calling monitor_puts(), this causes block migration
to segfault as its functions call monitor_printf() with a
NULL 'mon'.
This is probably hiding the real bug, but for some reason this
has been the behavior for a long time.
We also change monitor_print_object() to use monitor_print(),
so that monitor_puts() is only called by monitor_vprintf().
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
diff --git a/monitor.c b/monitor.c
index b035e0b..6d0b1dd 100644
--- a/monitor.c
+++ b/monitor.c
@@ -171,9 +171,6 @@ static void monitor_puts(Monitor *mon, const char *str)
{
char c;
- if (!mon)
- return;
-
for(;;) {
c = *str++;
if (c == '\0')
@@ -189,6 +186,9 @@ static void monitor_puts(Monitor *mon, const char *str)
void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
{
+ if (!mon)
+ return;
+
if (mon->mc && !mon->mc->print_enabled) {
qemu_error_new(QERR_UNDEFINED_ERROR);
} else {
@@ -269,7 +269,7 @@ static void monitor_print_qobject(Monitor *mon, const QObject *data)
break;
}
- monitor_puts(mon, "\n");
+ monitor_printf(mon, "\n");
}
static void monitor_json_emitter(Monitor *mon, const QObject *data)
next reply other threads:[~2009-12-03 18:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-03 18:21 Luiz Capitulino [this message]
2009-12-03 18:36 ` [Qemu-devel] Re: [STAGING]: Block migration segfaults Jan Kiszka
2009-12-03 18:59 ` Luiz Capitulino
2009-12-03 19:10 ` Jan Kiszka
2009-12-03 19:47 ` Anthony Liguori
2009-12-03 19:44 ` Anthony Liguori
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=20091203162121.67d9c120@doriath \
--to=lcapitulino@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=lirans@il.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.