From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E29AC41604 for ; Tue, 6 Oct 2020 10:02:46 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2700620674 for ; Tue, 6 Oct 2020 10:02:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="y4SdhmFC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2700620674 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xPV2M3XDQhxNHISBTHhlHsIEp+Wibjoqvpjaw8GAT74=; b=y4SdhmFCYT+P84L5zmo3QhKje yOMkzAPYt4iLye1q13fTzZjd2KycBZAcGFNM7iyO6TYlpaVJGigGeTuDpZD5BoZkYo8FhjNkTyVsd 23tpb78oEC3VuqUB8/38G3/rPmAqGnsZ+Qzx18uVJl9MFSDJwFs65nKUtq0Bgrdbuc+isqiXJOgDx q+N/tDQVe16a34oL1HYvsrfP9ArF24eKu5JcZf1Rq+gKRBHUCLAKZrFDY4XKG9hBFEzcepwXs9Xuh 0Ak5qetf1EcXWbGDHQFpLCOk5wiNB3awi1gMDcvoFv+m8vwAnjtZ5+Kslw+Z0PoBd2mfhbWZAhWkY SonadOvAw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kPjmk-0002eh-DU; Tue, 06 Oct 2020 10:01:30 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kPjmi-0002dk-6p for linux-arm-kernel@lists.infradead.org; Tue, 06 Oct 2020 10:01:29 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DE3BE113E; Tue, 6 Oct 2020 03:01:25 -0700 (PDT) Received: from arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 894AB3F66B; Tue, 6 Oct 2020 03:01:24 -0700 (PDT) Date: Tue, 6 Oct 2020 11:01:21 +0100 From: Dave Martin To: Will Deacon Subject: Re: [BUG][PATCH] crypto: arm64: Avoid indirect branch to bti_c Message-ID: <20201006100121.GW6642@arm.com> References: <20201006034854.2277538-1-jeremy.linton@arm.com> <20201006082748.GB25305@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201006082748.GB25305@willie-the-truck> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201006_060128_307713_1ADBA889 X-CRM114-Status: GOOD ( 23.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: herbert@gondor.apana.org.au, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, Jeremy Linton , davem@davemloft.net, broonie@kernel.org, linux-crypto@vger.kernel.org, ardb@kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Oct 06, 2020 at 09:27:48AM +0100, Will Deacon wrote: > On Mon, Oct 05, 2020 at 10:48:54PM -0500, Jeremy Linton wrote: > > The AES code uses a 'br x7' as part of a function called by > > a macro. That branch needs a bti_j as a target. This results > > in a panic as seen below. Instead of trying to replace the branch > > target with a bti_jc, lets replace the indirect branch with a > > bl/ret, bl sequence that can target the existing bti_c. > > > > Bad mode in Synchronous Abort handler detected on CPU1, code 0x34000003 -- BTI > > CPU: 1 PID: 265 Comm: cryptomgr_test Not tainted 5.8.11-300.fc33.aarch64 #1 > > pstate: 20400c05 (nzCv daif +PAN -UAO BTYPE=j-) > > pc : aesbs_encrypt8+0x0/0x5f0 [aes_neon_bs] > > lr : aesbs_xts_encrypt+0x48/0xe0 [aes_neon_bs] > > sp : ffff80001052b730 > > > > aesbs_encrypt8+0x0/0x5f0 [aes_neon_bs] > > __xts_crypt+0xb0/0x2dc [aes_neon_bs] > > xts_encrypt+0x28/0x3c [aes_neon_bs] > > crypto_skcipher_encrypt+0x50/0x84 > > simd_skcipher_encrypt+0xc8/0xe0 > > crypto_skcipher_encrypt+0x50/0x84 > > test_skcipher_vec_cfg+0x224/0x5f0 > > test_skcipher+0xbc/0x120 > > alg_test_skcipher+0xa0/0x1b0 > > alg_test+0x3dc/0x47c > > cryptomgr_test+0x38/0x60 > > > > Fixes: commit 0e89640b640d ("crypto: arm64 - Use modern annotations for assembly functions") > > nit: the "commit" string shouldn't be here, and I think the linux-next > scripts will yell at us if we don't remove it. > > > Signed-off-by: Jeremy Linton > > --- > > arch/arm64/crypto/aes-neonbs-core.S | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/arch/arm64/crypto/aes-neonbs-core.S b/arch/arm64/crypto/aes-neonbs-core.S > > index b357164379f6..32f53ebe5e2c 100644 > > --- a/arch/arm64/crypto/aes-neonbs-core.S > > +++ b/arch/arm64/crypto/aes-neonbs-core.S > > @@ -788,7 +788,7 @@ SYM_FUNC_START_LOCAL(__xts_crypt8) > > > > 0: mov bskey, x21 > > mov rounds, x22 > > - br x7 > > + ret Dang, replied on an old version. Since this is logically a tail call, could we simply be using br x16 or br x17 for this? The architecture makes special provision for that so that the compiler can generate tail-calls. This assumes that those regs aren't clobbered by any veneered function call in the meantime, but all the calls here are local, so I don't think that is a concern. [...] Cheers ---Dave _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel