From patchwork Tue Jan 27 21:07:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 43858 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4688D2409D for ; Tue, 27 Jan 2015 21:12:14 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id d49sf8956970eek.2 for ; Tue, 27 Jan 2015 13:12:13 -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:in-reply-to:references: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=EpWEOCyAFQ4PWeoHYy1pWdyMSPtjJ0LiAnVHIjOFy8Q=; b=HmFq7ajgGCQOoa6JgsMnLiFutwOaLNYxUD0fU6UMtz8t58xdRTwntlwudYSJ9kUeGf UwbzEX/x3ojWfnnFwmGMPydTLggZ3KTJ/0XQYeX0z/12rAf/Cf1bW5W8eD9DyqCgRy/r Ld4OeH7fsvHpNK3AiR1WClLUJLR7UfYRgp5nhOldpet+fxgrLBlLjWTw2RD7hG+/of3u N9LF254OC5hjECtP2bWO4BTcIYuhoRDEhKs6He7aeScuPYHLtHX8UORRaqKE58HY11BO pSfB1MKugN5FLZg+h59xlYAr2wVXpCPDNY+bgbgbEQVqXczxJSahNK64DFhOSDCacpDR n1EQ== X-Gm-Message-State: ALoCoQmoyoq4L4z5kHMfU4K/xmnFtRuUHzDfO/Sqgcm7aSKegIve+bNEbKeOeUfBD06O7PflftKv X-Received: by 10.152.5.98 with SMTP id r2mr556358lar.6.1422393133480; Tue, 27 Jan 2015 13:12:13 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.182.140 with SMTP id ee12ls107776lac.1.gmail; Tue, 27 Jan 2015 13:12:13 -0800 (PST) X-Received: by 10.152.161.168 with SMTP id xt8mr4131778lab.35.1422393133330; Tue, 27 Jan 2015 13:12:13 -0800 (PST) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id jo18si1500291lab.32.2015.01.27.13.12.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 Jan 2015 13:12:13 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id ge10so15616147lab.10 for ; Tue, 27 Jan 2015 13:12:13 -0800 (PST) X-Received: by 10.112.131.1 with SMTP id oi1mr4193822lbb.2.1422393133255; Tue, 27 Jan 2015 13:12:13 -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.35.133 with SMTP id h5csp1227637lbj; Tue, 27 Jan 2015 13:12:12 -0800 (PST) X-Received: by 10.224.54.131 with SMTP id q3mr1615274qag.102.1422393132009; Tue, 27 Jan 2015 13:12:12 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s95si3181548qgs.30.2015.01.27.13.12.11 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 27 Jan 2015 13:12:12 -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]:49993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGDQg-0008S6-VD for patch@linaro.org; Tue, 27 Jan 2015 16:12:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGDMD-0004C0-72 for qemu-devel@nongnu.org; Tue, 27 Jan 2015 16:07:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGDM5-0005mC-4J for qemu-devel@nongnu.org; Tue, 27 Jan 2015 16:07:33 -0500 Received: from afflict.kos.to ([92.243.29.197]:35443) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGDM4-0005lo-VA for qemu-devel@nongnu.org; Tue, 27 Jan 2015 16:07:25 -0500 Received: from afflict.kos.to (afflict [92.243.29.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 636DB264E2; Tue, 27 Jan 2015 22:07:23 +0100 (CET) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 27 Jan 2015 23:07:21 +0200 Message-Id: <1669add752d9f29283f8ebf6a863d7b1e2d0f146.1422392096.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: peter.maydell@linaro.org Subject: [Qemu-devel] [PULL 10/11] 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: riku.voipio@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.215.51 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 From: Peter Maydell 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 Signed-off-by: Riku Voipio --- 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 8065710..5bb399e 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -5066,7 +5066,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 */ @@ -5200,8 +5200,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;