From patchwork Mon Apr 21 18:07:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rabin Vincent X-Patchwork-Id: 4025861 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 44639BFF02 for ; Mon, 21 Apr 2014 18:10:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7959720221 for ; Mon, 21 Apr 2014 18:10:25 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BFE59201C8 for ; Mon, 21 Apr 2014 18:10:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WcIdd-0005Ix-96; Mon, 21 Apr 2014 18:08:17 +0000 Received: from mail-la0-x22d.google.com ([2a00:1450:4010:c03::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WcIdb-00057a-86 for linux-arm-kernel@lists.infradead.org; Mon, 21 Apr 2014 18:08:15 +0000 Received: by mail-la0-f45.google.com with SMTP id hr17so3408647lab.4 for ; Mon, 21 Apr 2014 11:07:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=kmsP8JaK3Pajd84/RTntArDQmqT5J1tohXc2f2EU9EA=; b=K7hD4Ya0e5+LHM6T/aDyJG7XEcJQ/6rpbr7/07J0ePwmTd6fr7rxLS+ZroutHrf9ut nb4tGCxMqYaJCoWpMnX9h2Uo/I/pwNag4kMg/yJC5wrqLV32Nd8Ge167hmkSjEDYXfAm AMObrnU0MZOJbVmJ2eAih5+UnfM/UUwgruxLGDILJbwUgji1pSv9+tvE3VMPOx9VGgFR gveuUSzfvLl1PyKtiloVCDUQl87ckRwZMdZST9KKBr/MiEJn8TVTuQyhSeL4Ym3RBvXS zE4NUbFxVdUhw/zDlSZqM+UqqBOMGi0cq2+kwjXuF/CUjc6Pv8gRbnsRHGfBg2ROSsPU elHw== X-Received: by 10.112.163.69 with SMTP id yg5mr24141396lbb.14.1398103672739; Mon, 21 Apr 2014 11:07:52 -0700 (PDT) Received: from localhost.localdomain (217-211-190-200-no39.tbcn.telia.com. [217.211.190.200]) by mx.google.com with ESMTPSA id eo12sm38088478lbb.13.2014.04.21.11.07.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Apr 2014 11:07:52 -0700 (PDT) From: Rabin Vincent To: u.kleine-koenig@pengutronix.de, Catalin Marinas Subject: [PATCH] ARM: fix v7-M signal return Date: Mon, 21 Apr 2014 20:07:44 +0200 Message-Id: <1398103664-23078-1-git-send-email-rabin@rab.in> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140421_110815_471737_31A180C9 X-CRM114-Status: GOOD ( 11.40 ) X-Spam-Score: 0.0 (/) Cc: Rabin Vincent , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP According to the ARM ARM, the behaviour is UNDPREDICTABLE if the PC read from the exception return stack is not half word aligned. See the pseudo code for ExceptionReturn() and PopStack(). The signal handler's address has the bit 0 set, and setup_return() directly writes this to regs->ARM_pc. Mask out bit 0 before the exception return to get predictable behaviour. Signed-off-by: Rabin Vincent --- arch/arm/kernel/entry-header.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S index 1420725..ef72f4b 100644 --- a/arch/arm/kernel/entry-header.S +++ b/arch/arm/kernel/entry-header.S @@ -133,6 +133,7 @@ biceq r5, V7M_xPSR_FRAMEPTRALIGN @ write basic exception frame + bic r4, r4, #1 stmdb r2!, {r1, r3-r5} ldmia sp, {r1, r3-r5} .if \ret_r0