Received: from eggs.gnu.org ([2001:4830:134:3::10]:46026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azkUK-0000lh-Cg for qemu-devel@nongnu.org; Mon, 09 May 2016 08:40:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azkUF-0002m8-9b for qemu-devel@nongnu.org; Mon, 09 May 2016 08:40:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47691) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azkUE-0002lu-Ug for qemu-devel@nongnu.org; Mon, 09 May 2016 08:40:35 -0400 From: Stefan Hajnoczi Date: Mon, 9 May 2016 13:07:49 +0100 Message-Id: <1462795687-25698-6-git-send-email-stefanha@redhat.com> In-Reply-To: <1462795687-25698-1-git-send-email-stefanha@redhat.com> References: <1462795687-25698-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH v2 05/23] replay: Fix dangling location bug in replay_configure() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: marc.mari.barcelo@gmail.com, Paolo Bonzini , jsnow@redhat.com, Markus Armbruster , Eduardo Habkost From: Markus Armbruster 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 Signed-off-by: Markus Armbruster Message-Id: <1461767349-15329-3-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Eduardo Habkost --- 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