From patchwork Tue Sep 17 18:34:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 2903431 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 76E6B9F1BF for ; Tue, 17 Sep 2013 18:34:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 614832027D for ; Tue, 17 Sep 2013 18:34:46 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 58ACE201F8 for ; Tue, 17 Sep 2013 18:34:45 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VM06j-0005yG-Nj; Tue, 17 Sep 2013 18:34:41 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VM06h-0004n3-Ge; Tue, 17 Sep 2013 18:34:39 +0000 Received: from mail-qc0-f180.google.com ([209.85.216.180]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VM06e-0004lu-QY for linux-arm-kernel@lists.infradead.org; Tue, 17 Sep 2013 18:34:37 +0000 Received: by mail-qc0-f180.google.com with SMTP id p19so3836250qcv.39 for ; Tue, 17 Sep 2013 11:34:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version:content-type; bh=7NhreW3xSwUqGuKfPpGheCHf2YFoD59/Ln5ourvcvgI=; b=CrmBQvX06oa7EpM1rBTUYq2Vojp4bOdyg4X2c2AmSfTl1cTc+ugVpyy4O1zENBziAd jh/wrLiqQSjzfd0rGIpb4vsdyWsSRTh9l5n4WRoOzApy7J1e12DzL4yiVmA0crbQSUj0 sPLGBtIe6+Ud/Hu4nbbrP338XqIQHiOA4SGePcGxkJeAkoSHZ8N6D79e/BT94f4oZ3kQ ldeukauIs2SlwVE6AMVfqRdW2n8SDskhC4MckZ1xCFSGw8cQCCqtqMphYwqsJHjEfxKK bQWjF266ggQVn+KqbTTrc+xJlUqFgJGrhTjzGXrAPmnOX6uRKyczThQLa75BvHt9WtJD K7uw== X-Gm-Message-State: ALoCoQl5j8dni6xIChFp07GdlpVkqhsONJwQjNyrWEcKPPmhaj6YZw/SaryxkcTIg6Hgvt7qDP6r X-Received: by 10.224.167.18 with SMTP id o18mr8905537qay.87.1379442854403; Tue, 17 Sep 2013 11:34:14 -0700 (PDT) Received: from xanadu.home (modemcable044.209-83-70.mc.videotron.ca. [70.83.209.44]) by mx.google.com with ESMTPSA id h2sm57432565qev.0.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 17 Sep 2013 11:34:13 -0700 (PDT) Date: Tue, 17 Sep 2013 14:34:12 -0400 (EDT) From: Nicolas Pitre To: Ard Biesheuvel Subject: Re: [PATCH v2] ARM: fix Thumb-2 bug in AES assembler code In-Reply-To: <1379438195-6911-1-git-send-email-ard.biesheuvel@linaro.org> Message-ID: References: <1379438195-6911-1-git-send-email-ard.biesheuvel@linaro.org> User-Agent: Alpine 2.03 (LFD 1266 2009-07-14) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130917_143436_890381_C49D46D3 X-CRM114-Status: GOOD ( 14.01 ) X-Spam-Score: -2.6 (--) Cc: dave.martin@arm.com, 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 On Tue, 17 Sep 2013, Ard Biesheuvel wrote: > Patch 638591c enabled building the AES assembler code in Thumb2 mode. > However, this code used arithmetic involving PC rather than adr{l} > instructions to generate PC-relative references to the lookup tables, > and this break in Thumb mode due to the different PC offset. > > Use adr instructions instead. > > Signed-off-by: Ard Biesheuvel > --- > > v2: > - use 'adr' instruction rather than explicit PC arithmetic > - move the tables around so they are in range for 'adr' in each mode > > arch/arm/crypto/aes-armv4.S | 388 ++++++++++++++++++++++---------------------- > 1 file changed, 193 insertions(+), 195 deletions(-) No no no. NAK. This makes the patch completely unreviewable. And unacceptable for inclusion into the stable tree. Also, why do you have to move tables around? Isn't the following sufficient to fix the issue? diff --git a/arch/arm/crypto/aes-armv4.S b/arch/arm/crypto/aes-armv4.S index 19d6cd6f29..3a14ea8fe9 100644 --- a/arch/arm/crypto/aes-armv4.S +++ b/arch/arm/crypto/aes-armv4.S @@ -148,7 +148,7 @@ AES_Te: @ const AES_KEY *key) { .align 5 ENTRY(AES_encrypt) - sub r3,pc,#8 @ AES_encrypt + adr r3,AES_encrypt stmdb sp!,{r1,r4-r12,lr} mov r12,r0 @ inp mov r11,r2 @@ -381,7 +381,7 @@ _armv4_AES_encrypt: .align 5 ENTRY(private_AES_set_encrypt_key) _armv4_AES_set_encrypt_key: - sub r3,pc,#8 @ AES_set_encrypt_key + adr r3,_armv4_AES_set_encrypt_key teq r0,#0 moveq r0,#-1 beq .Labrt @@ -843,7 +843,7 @@ AES_Td: @ const AES_KEY *key) { .align 5 ENTRY(AES_decrypt) - sub r3,pc,#8 @ AES_decrypt + adr r3,AES_decrypt stmdb sp!,{r1,r4-r12,lr} mov r12,r0 @ inp mov r11,r2