From patchwork Tue Apr 21 10:59:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 47394 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 368E42121F for ; Tue, 21 Apr 2015 11:02:36 +0000 (UTC) Received: by laat2 with SMTP id t2sf45945738laa.2 for ; Tue, 21 Apr 2015 04:02:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=zHdn3gPohmb2TOz54z9Ry7uuCfPXzQWpnKH4Z71YpBk=; b=fjnA5VdrOlptfyRJkrfY7crDtPHKUzThvH2CFQsJK/eoEKR69R0kt0u7jR/beXWL93 RucgXs+xhWvCJ1wCqShlvAyHuj7hJ0E9tHLMZV+dR34DIlUKlrY2VbdLd74dxY8llR7a dYSl0JzIEqEfucDJxLi9rKO9rKZwJKilk/pX3RAZrQbak+SWZCJlDJqR6Xh0Glg/mXmp wQ1Z1kkNBz+sTVZTA/GJvfJQ8xv6fnkpey29yAQwitjQFKw8e7YJJxdC63z7We5lNAhl rlM9IDEVy1GhL7HdDE0KnaTTiN02KjMWsMcXoZSMOMR0qUcGcG2qLkjj3sZPIp2bgW27 682g== X-Gm-Message-State: ALoCoQmb81aIld3d4PxifwCGhYu4WqBbAM2pALvkEK+wJDRCIdQ8Ap2FnvXnnPt50wpkKoUIWb6R X-Received: by 10.180.96.6 with SMTP id do6mr7967257wib.4.1429614155106; Tue, 21 Apr 2015 04:02:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.244.162 with SMTP id xh2ls30592lac.108.gmail; Tue, 21 Apr 2015 04:02:34 -0700 (PDT) X-Received: by 10.152.42.141 with SMTP id o13mr19763209lal.33.1429614154877; Tue, 21 Apr 2015 04:02:34 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id s10si1085597lae.50.2015.04.21.04.02.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Apr 2015 04:02:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbcga7 with SMTP id ga7so152797758lbc.1 for ; Tue, 21 Apr 2015 04:02:34 -0700 (PDT) X-Received: by 10.112.199.133 with SMTP id jk5mr20138977lbc.32.1429614154464; Tue, 21 Apr 2015 04:02:34 -0700 (PDT) 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.67.65 with SMTP id l1csp558641lbt; Tue, 21 Apr 2015 04:02:33 -0700 (PDT) X-Received: by 10.70.0.143 with SMTP id 15mr36778929pde.13.1429614152775; Tue, 21 Apr 2015 04:02:32 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id lo3si2438512pab.58.2015.04.21.04.02.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Apr 2015 04:02:32 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; 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 1YkVvB-0002dU-Cf; Tue, 21 Apr 2015 11:00:53 +0000 Received: from mail-wi0-f175.google.com ([209.85.212.175]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YkVun-0002MO-Eo for linux-arm-kernel@lists.infradead.org; Tue, 21 Apr 2015 11:00:30 +0000 Received: by wiax7 with SMTP id x7so104514531wia.0 for ; Tue, 21 Apr 2015 04:00:07 -0700 (PDT) X-Received: by 10.180.19.134 with SMTP id f6mr33599122wie.35.1429614007267; Tue, 21 Apr 2015 04:00:07 -0700 (PDT) Received: from ards-macbook-pro.local ([90.174.5.83]) by mx.google.com with ESMTPSA id js3sm2112312wjc.5.2015.04.21.04.00.05 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Apr 2015 04:00:06 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk, dave.martin@arm.com Subject: [PATCH v2 2/2] ARM: Thumb2: use "bx reg" not "mov pc, reg" for all registers Date: Tue, 21 Apr 2015 12:59:43 +0200 Message-Id: <1429613983-22739-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1429613983-22739-1-git-send-email-ard.biesheuvel@linaro.org> References: <1429613983-22739-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150421_040029_660939_11AB9076 X-CRM114-Status: UNSURE ( 8.99 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.175 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.212.175 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Ard Biesheuvel , nico@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@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.179 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 Commit 6ebbf2ce437b (ARM: convert all "mov.* pc, reg" to "bx reg" for ARMv6+) replaced all occurrences of 'mov pc, ' with the 'ret' macro. However, this macro only emits the 'bx' instruction when used with the 'lr' register, but still uses 'mov pc, ' for everything else. Since ARM/Thumb2 interworking is allowed in the static kernel (i.e., inside vmlinux), this is potentially unsafe, since the Thumb mov instruction T1 variant that allows PC as the target will not switch modes based on the Thumb bit So when building a Thumb2 kernel, emit the 'bx' instruction for all registers, not just the 'lr' register. Signed-off-by: Ard Biesheuvel --- arch/arm/include/asm/assembler.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h index 186270b3e194..1c057f923258 100644 --- a/arch/arm/include/asm/assembler.h +++ b/arch/arm/include/asm/assembler.h @@ -434,6 +434,8 @@ THUMB( orr \reg , \reg , #PSR_T_BIT ) .macro ret\c, reg #if __LINUX_ARM_ARCH__ < 6 mov\c pc, \reg +#elif defined(CONFIG_THUMB2_KERNEL) + bx\c \reg #else .ifeqs "\reg", "lr" bx\c \reg