From patchwork Tue Jun 19 02:31:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Wood X-Patchwork-Id: 165631 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EC8C5B6FB7 for ; Tue, 19 Jun 2012 13:02:03 +1000 (EST) Received: from localhost ([::1]:38259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sgohb-0004jk-Bm for incoming@patchwork.ozlabs.org; Mon, 18 Jun 2012 23:01:59 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgohR-0004iv-IJ for qemu-devel@nongnu.org; Mon, 18 Jun 2012 23:01:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SgohP-0002Fi-TO for qemu-devel@nongnu.org; Mon, 18 Jun 2012 23:01:49 -0400 Received: from ch1ehsobe004.messaging.microsoft.com ([216.32.181.184]:48182 helo=ch1outboundpool.messaging.microsoft.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgohP-0002Fa-Om for qemu-devel@nongnu.org; Mon, 18 Jun 2012 23:01:47 -0400 Received: from mail46-ch1-R.bigfish.com (10.43.68.245) by CH1EHSOBE007.bigfish.com (10.43.70.57) with Microsoft SMTP Server id 14.1.225.23; Tue, 19 Jun 2012 02:30:20 +0000 Received: from mail46-ch1 (localhost [127.0.0.1]) by mail46-ch1-R.bigfish.com (Postfix) with ESMTP id 5A721160122; Tue, 19 Jun 2012 02:30:20 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839h944hd25hf0ah) Received: from mail46-ch1 (localhost.localdomain [127.0.0.1]) by mail46-ch1 (MessageSwitch) id 1340073019135521_13903; Tue, 19 Jun 2012 02:30:19 +0000 (UTC) Received: from CH1EHSMHS024.bigfish.com (snatpool2.int.messaging.microsoft.com [10.43.68.235]) by mail46-ch1.bigfish.com (Postfix) with ESMTP id 1F6C93A0048; Tue, 19 Jun 2012 02:30:19 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS024.bigfish.com (10.43.70.24) with Microsoft SMTP Server (TLS) id 14.1.225.23; Tue, 19 Jun 2012 02:30:19 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server (TLS) id 14.2.298.5; Mon, 18 Jun 2012 21:31:37 -0500 Received: from tyr.buserror.net ([10.214.84.71]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id q5J2VaKc031525; Mon, 18 Jun 2012 19:31:37 -0700 Date: Mon, 18 Jun 2012 21:31:36 -0500 From: Scott Wood To: Stefan Weil Message-ID: <20120619023136.GA5187@tyr.buserror.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-OriginatorOrg: freescale.com X-detected-operating-system: by eggs.gnu.org: Windows XP/2000 (RFC1323+, w+, tstamp-) X-Received-From: 216.32.181.184 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] tci: don't write zero for reloc in tci_out_label X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org If tci_out_label is called in the context of tcg_gen_code_search_pc, we could be overwriting an already patched relocation with zero -- and not repatch it because the set_label is past search_pc, causing a QEMU crash when it tries to branch to a zero label. Not writing anything to the relocation area seems to be in line with what other backends do from the couple I looked at (x86, ppc). Signed-off-by: Scott Wood Tested-by: Stefan Weil --- tcg/tci/tcg-target.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tcg/tci/tcg-target.c b/tcg/tci/tcg-target.c index 453f187..3c6b0f5 100644 --- a/tcg/tci/tcg-target.c +++ b/tcg/tci/tcg-target.c @@ -487,7 +487,7 @@ static void tci_out_label(TCGContext *s, TCGArg arg) assert(label->u.value); } else { tcg_out_reloc(s, s->code_ptr, sizeof(tcg_target_ulong), arg, 0); - tcg_out_i(s, 0); + s->code_ptr += sizeof(tcg_target_ulong); } }