From patchwork Fri Nov 18 09:02:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 13047877 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3795FC4332F for ; Fri, 18 Nov 2022 09:06:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gzGin0NsiCeEZ79TLSi9BEGnbd0hpN7tY0r3govmUsk=; b=eECYM/FxAVbysM FTdNTDsPtSQOneD5K01KFDBm6E1+KHLoKCj2VML6OsOdT9dfCWsdWyiG1LAEnozVuwD5fuEEFav9d x+GisaX3UpEZRt6kTizmNABye9ebHKxyvwzXx+LTZQqSqvjcSrfcse7iND9O8k6WwVkGiKN5Ynkfa BzJSJ3TyK3/pKptSgreVXGoS2AA8bcmmsVp3TDdXsnjoWz71cH/mZSB5+taJtl2BGkWQD+unWmDf9 u4yWxcAwc1JFSBkByJafbcEtgyCTSYTU4+hsHEQ0b6JIBsDiMxOyHcbLCz7EB82RyfHmukruwgNTB 0KANV9kKzvCHxXk+Jf1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovxJc-002wWP-Sa; Fri, 18 Nov 2022 09:05:41 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovxIA-002vvz-WE for linux-arm-kernel@lists.infradead.org; Fri, 18 Nov 2022 09:04:14 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1DF01623C4; Fri, 18 Nov 2022 09:04:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C609FC433D7; Fri, 18 Nov 2022 09:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668762249; bh=wyK4erNXYZLb0gGezT+2lcL+zroMKoz8h7GycCvuO2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NqABtUTYY1aVx9PfXGJq58Dbdt7rDMgcoP+hSxU5ThNarF3tRMyvrwQwAEkXDGUO5 tiJ5U6LMLR0lV4JumLMkHK8INpJW3VIBKbH25sTBOZ87643hheINT8JJZJRVNf2TJF Avmp31f8rb9nVNMm7VPa6EXaX/IeeMYxx0SdXLQ4veF50FCyygcXgJzJ0h/mNWUiz0 nXsrpByKTHAWcFIFVyfqlGKRd3pquE2LM5zke5eFjTEU3S7TFTNO9O/gQ3AjOeWI8Y mPsBOdZcHGDb2+C+DgTlFSdpfjQy/mk723T/7DJTGcpPCtgOYlXcdr21Vaz+4C3FCr kxX8ORTboM8rw== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: x86@kernel.org, linux-arm-kernel@lists.infradead.org, Sami Tolvanen Subject: [PATCH 09/11] crypto: arm64/sm3 - fix possible crash with CFI enabled Date: Fri, 18 Nov 2022 01:02:18 -0800 Message-Id: <20221118090220.398819-10-ebiggers@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221118090220.398819-1-ebiggers@kernel.org> References: <20221118090220.398819-1-ebiggers@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221118_010411_140148_702E2630 X-CRM114-Status: GOOD ( 13.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Eric Biggers sm3_neon_transform() is called via indirect function calls. This function needs to use SYM_TYPED_FUNC_START instead of SYM_FUNC_START to cause type hashes to be emitted when the kernel is built with CONFIG_CFI_CLANG=y. Otherwise, the code crashes with a CFI failure (if the compiler didn't happen to optimize out the indirect call). Fixes: c50d32859e70 ("arm64: Add types to indirect called assembly functions") Signed-off-by: Eric Biggers --- arch/arm64/crypto/sm3-neon-core.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/crypto/sm3-neon-core.S b/arch/arm64/crypto/sm3-neon-core.S index 3e3b4e5c736fc..8abea1d39ddd9 100644 --- a/arch/arm64/crypto/sm3-neon-core.S +++ b/arch/arm64/crypto/sm3-neon-core.S @@ -9,7 +9,7 @@ */ #include -#include +#include /* Context structure */ @@ -351,7 +351,7 @@ */ .text .align 3 -SYM_FUNC_START(sm3_neon_transform) +SYM_TYPED_FUNC_START(sm3_neon_transform) ldp ra, rb, [RSTATE, #0] ldp rc, rd, [RSTATE, #8] ldp re, rf, [RSTATE, #16]