From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: Eduardo Habkost <ehabkost@redhat.com>
Subject: [Qemu-devel] [PULL for-2.6 2/3] replay: Fix dangling location bug in replay_configure()
Date: Thu, 28 Apr 2016 08:28:12 +0200 [thread overview]
Message-ID: <1461824893-21125-3-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1461824893-21125-1-git-send-email-armbru@redhat.com>
replay_configure() pushes and pops a Location with automatic storage
duration. Except it fails to pop when -icount parameter "rr" isn't
given. cur_loc then points to unused stack space, and will most
likely get clobbered in short order.
Clobbered cur_loc can make loc_pop() and error_print_loc() crash or
report bogus locations.
Broken in commit 890ad55.
I didn't take the time to find a reproducer.
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1461767349-15329-3-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
---
replay/replay.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/replay/replay.c b/replay/replay.c
index 7c2573a..167fd29 100644
--- a/replay/replay.c
+++ b/replay/replay.c
@@ -275,7 +275,7 @@ void replay_configure(QemuOpts *opts)
rr = qemu_opt_get(opts, "rr");
if (!rr) {
/* Just enabling icount */
- return;
+ goto out;
} else if (!strcmp(rr, "record")) {
mode = REPLAY_MODE_RECORD;
} else if (!strcmp(rr, "replay")) {
@@ -293,6 +293,7 @@ void replay_configure(QemuOpts *opts)
replay_enable(fname, mode);
+out:
loc_pop(&loc);
}
--
2.5.5
next prev parent reply other threads:[~2016-04-28 6:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-28 6:28 [Qemu-devel] [PULL for-2.6 0/3] Fix dangling pointers and error message regressions Markus Armbruster
2016-04-28 6:28 ` [Qemu-devel] [PULL for-2.6 1/3] QemuOpts: Fix qemu_opts_foreach() dangling location regression Markus Armbruster
2016-04-28 6:28 ` Markus Armbruster [this message]
2016-04-28 6:28 ` [Qemu-devel] [PULL for-2.6 3/3] qom: -object error messages lost location, restore it Markus Armbruster
2016-04-28 10:47 ` [Qemu-devel] [PULL for-2.6 0/3] Fix dangling pointers and error message regressions Peter Maydell
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=1461824893-21125-3-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=ehabkost@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).