From patchwork Mon Dec 22 17:47:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 42538 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EE2DA2188F for ; Mon, 22 Dec 2014 17:47:42 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id hs14sf3182291lab.5 for ; Mon, 22 Dec 2014 09:47:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=1t6EjxulvJ6UAP2YsRtwpwCkgyn+9ANtmnmtKGo9ibs=; b=IpPlwTIA9fF8cFi9+arXoccxthn08Xe8ctKwI/Di8eMShPO5HoYxiBQQ1qdF3I1P6z TpLkqMMnUYVBdCtyvbaG4Gc2/EpmJL14EReO7mtjJ2cjTT9EL1vKDEBoCb6OlZk4l1ge DMyyKCcUDjR7n7FP7PwkCpKwT01HTRWML6gcjPWgEa925WYriG+zBgqlwreEaUoUgAVG TTi+UMmKHfu9w6CXiJUH8o6zWFQR9MMT7JxyopsBRgjj2OV4G9LDr4dgWhHIlxMeU+4Q XQM2jkFgIM/Y0N4MCXKrEzU9Rk0uFMEZrIHR6UN/8ahjhHHb8aGucaTBbwYpihqOWR5Y R/9Q== X-Gm-Message-State: ALoCoQltrv5GQ0ienpHWtteXXCNvaYBGlVSX5UPAmxKqnUYrWmZ68NyQasBYXW63dOBHMqolRDVD X-Received: by 10.180.24.35 with SMTP id r3mr2278961wif.0.1419270461413; Mon, 22 Dec 2014 09:47:41 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.67 with SMTP id z3ls1378175lag.2.gmail; Mon, 22 Dec 2014 09:47:41 -0800 (PST) X-Received: by 10.152.27.130 with SMTP id t2mr22728863lag.28.1419270461191; Mon, 22 Dec 2014 09:47:41 -0800 (PST) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id y9si19107602lal.110.2014.12.22.09.47.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Dec 2014 09:47:40 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id f15so4651851lbj.23 for ; Mon, 22 Dec 2014 09:47:40 -0800 (PST) X-Received: by 10.152.87.12 with SMTP id t12mr23244759laz.31.1419270460738; Mon, 22 Dec 2014 09:47:40 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp1098335lbb; Mon, 22 Dec 2014 09:47:40 -0800 (PST) X-Received: by 10.140.34.67 with SMTP id k61mr25023702qgk.95.1419270459228; Mon, 22 Dec 2014 09:47:39 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f3si20679935qcg.36.2014.12.22.09.47.38 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 22 Dec 2014 09:47:39 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:41442 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3750-0005hq-B6 for patch@linaro.org; Mon, 22 Dec 2014 12:47:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y374c-0005RK-6T for qemu-devel@nongnu.org; Mon, 22 Dec 2014 12:47:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y374X-0007bP-2B for qemu-devel@nongnu.org; Mon, 22 Dec 2014 12:47:14 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:54610) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y374W-0007Z8-Sh for qemu-devel@nongnu.org; Mon, 22 Dec 2014 12:47:09 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Y374O-0002n2-PD; Mon, 22 Dec 2014 17:47:00 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 22 Dec 2014 17:47:00 +0000 Message-Id: <1419270420-10699-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: Riku Voipio Subject: [Qemu-devel] [PATCH] linux-user: Fix broken m68k signal handling on 64 bit hosts 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The m68k signal frame setup code which writes the signal return trampoline code to the stack was assuming that a 'long' was 32 bits; on 64 bit systems this meant we would end up writing the 32 bit (2 insn) trampoline sequence to retaddr+4,retaddr+6 instead of the intended retaddr+0,retaddr+2, resulting in a guest crash when it tried to execute the invalid zero-bytes at retaddr+0. Fix by using uint32_t instead; also use uint16_t rather than short for consistency. This fixes bug LP:1404690. Reported-by: Michel Boaventura Signed-off-by: Peter Maydell --- linux-user/signal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index e11b208..a324fd1 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -5091,7 +5091,7 @@ static void setup_frame(int sig, struct target_sigaction *ka, /* moveq #,d0; trap #0 */ __put_user(0x70004e40 + (TARGET_NR_sigreturn << 16), - (long *)(frame->retcode)); + (uint32_t *)(frame->retcode)); /* Set up to return from userspace */ @@ -5225,8 +5225,8 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka, /* moveq #,d0; notb d0; trap #0 */ __put_user(0x70004600 + ((TARGET_NR_rt_sigreturn ^ 0xff) << 16), - (long *)(frame->retcode + 0)); - __put_user(0x4e40, (short *)(frame->retcode + 4)); + (uint32_t *)(frame->retcode + 0)); + __put_user(0x4e40, (uint16_t *)(frame->retcode + 4)); if (err) goto give_sigsegv;