From patchwork Wed May 7 09:51:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Murphy X-Patchwork-Id: 4126821 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 09816BFF02 for ; Wed, 7 May 2014 09:56:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 49D812018E for ; Wed, 7 May 2014 09:56:54 +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 654BD201B4 for ; Wed, 7 May 2014 09:56:53 +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 1WhyYy-0004f7-6C; Wed, 07 May 2014 09:54:56 +0000 Received: from service87.mimecast.com ([91.220.42.44]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WhyYp-0004Uw-5d for linux-arm-kernel@lists.infradead.org; Wed, 07 May 2014 09:54:47 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 07 May 2014 10:52:15 +0100 Received: from e104324-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 7 May 2014 10:52:23 +0100 From: Robin Murphy To: linux-arm-kernel@lists.infradead.org Subject: [PATCH RESEND 1/2] arm: SIGBUS on unsupported ARMv6 unaligned accesses Date: Wed, 7 May 2014 10:51:56 +0100 Message-Id: <6c89b740173398578fa999c99237858b7680a84e.1399028497.git.robin.murphy@arm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: X-OriginalArrivalTime: 07 May 2014 09:52:23.0266 (UTC) FILETIME=[0B6F3C20:01CF69DA] X-MC-Unique: 114050710521510201 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140507_025447_517963_F269CC2F X-CRM114-Status: GOOD ( 11.59 ) X-Spam-Score: -0.7 (/) Cc: simon.hosie@arm.com, Russell King , dave.martin@arm.com 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.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 This patch changes the default behaviour for userspace alignment faults on v6 from silent fixup to SIGBUS. This only affects code that violates the v6 unaligned access model - bad assembly/JIT code or high-level language code in violation of the relevant language spec - which should be corrected rather than unwittingly relying on performance-degrading fixups. Fixup behaviour can still be controlled from boot parameters or at runtime for compatibility with existing incorrect software. There will be no impact for v5 and earlier. Signed-off-by: Robin Murphy Reviewed-by: Dave Martin Cc: Russell King --- This one is already in the patch system as 7944/1, since nobody objected to the original RFC or patch postings. Russell: any news on whether you're happy to take this? arch/arm/mm/alignment.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c index 9240364..9a93315 100644 --- a/arch/arm/mm/alignment.c +++ b/arch/arm/mm/alignment.c @@ -106,10 +106,10 @@ static int safe_usermode(int new_usermode, bool warn) * making any progress. */ if (cpu_is_v6_unaligned() && !(new_usermode & (UM_FIXUP | UM_SIGNAL))) { - new_usermode |= UM_FIXUP; + new_usermode |= UM_SIGNAL; if (warn) - printk(KERN_WARNING "alignment: ignoring faults is unsafe on this CPU. Defaulting to fixup mode.\n"); + printk(KERN_WARNING "alignment: ignoring faults is unsafe on this CPU. Defaulting to signal mode.\n"); } return new_usermode; @@ -971,7 +971,7 @@ static int __init alignment_init(void) cr_alignment &= ~CR_A; cr_no_alignment &= ~CR_A; set_cr(cr_alignment); - ai_usermode = safe_usermode(ai_usermode, false); + ai_usermode = safe_usermode(ai_usermode | UM_WARN, false); } #endif