From patchwork Mon Feb 27 06:32:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 13152880 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 7B185C64ED6 for ; Mon, 27 Feb 2023 06:34:43 +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: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:In-Reply-To:References: List-Owner; bh=Sp5qEywxww8aQO6hVIlSuAS8in1hXgzcHc5jwSd9HQ0=; b=blNe9xc49zsoj5 fYIq1FtT1tMHM1HKF8Hn8C4NStg9A6fW9AXqZM5PwFp0zCGCsg3KthT1MHkjljR4/qs/5AN59+mdc GEjPf6AtuxhOXsejAHX1Xbibj+TC9t0I3qYMZHPWr3EWJUQHidFroh8kJcH/0DRbWZTejnrIiGYHp 87S57pe5+fWeZA3DDoSoDXWrnZdIdViaoBmHG1mNKYhaCyDHWo6Na6/6udYOff87VdpOcTs+4PgJH UUga/JWSNcMD7CDnmXZMRa9KheqhGg21gmkP42G+OdwGpCNtn9Sy6NPSE4XjUOoXlTf0/oPCpeD98 OFeBVRrwjVYjgNqk6Axw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWX4p-008aLt-Uy; Mon, 27 Feb 2023 06:33:36 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWX4l-008aL9-2u for linux-arm-kernel@lists.infradead.org; Mon, 27 Feb 2023 06:33:34 +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 ams.source.kernel.org (Postfix) with ESMTPS id 9E11CB80C94; Mon, 27 Feb 2023 06:33:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 421A1C433D2; Mon, 27 Feb 2023 06:33:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1677479607; bh=a5mHCJD7eGPHcY7tdYCOHWp/H8HJlXIIMr3FEKuf2dI=; h=From:To:Cc:Subject:Date:From; b=WyLuIGrk3u3eei9RYGf3GFDOiW81rpJWwPmzp2E76grynA6jGtii5HlenrRj3jH8E 3McoJcTqPTxUPjq2RdrxDu1Nb/5rr4aBVUfQcsKXyfb/WEkuWrU/QOLs0Bq9/aG25C 1tBdpFzoVa2eyjJGmdeW6H4NktxFJEJ0SX1Rcwd8lZNOrebv64lm+K6+ChyUqkD1Qj CLVb9uK0new5un+aaup/J8mooWB5LVjo2RPg+AHZyJ1FlCsG90XEBDaYpDs+rFsQ6E ukYdIrhb9TbScHkV2wUiaqpigwQuAdN8H1jiN2ec1vF+2hTITUGF7nknoc21/p7L8y lXHn5ZtkDqfZw== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Sami Tolvanen , stable@vger.kernel.org Subject: [PATCH] crypto: arm64/aes-neonbs - fix crash with CFI enabled Date: Sun, 26 Feb 2023 22:32:23 -0800 Message-Id: <20230227063223.1829703-1-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230226_223331_324470_C40938A5 X-CRM114-Status: GOOD ( 11.39 ) 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 aesbs_ecb_encrypt(), aesbs_ecb_decrypt(), aesbs_xts_encrypt(), and aesbs_xts_decrypt() are called via indirect function calls. Therefore they need to use SYM_TYPED_FUNC_START instead of SYM_FUNC_START to cause their 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 doesn't happen to optimize out the indirect calls. Fixes: c50d32859e70 ("arm64: Add types to indirect called assembly functions") Cc: stable@vger.kernel.org Signed-off-by: Eric Biggers Reviewed-by: Ard Biesheuvel --- arch/arm64/crypto/aes-neonbs-core.S | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) base-commit: f3a2439f20d918930cc4ae8f76fe1c1afd26958f diff --git a/arch/arm64/crypto/aes-neonbs-core.S b/arch/arm64/crypto/aes-neonbs-core.S index 7278a37c2d5c..baf450717b24 100644 --- a/arch/arm64/crypto/aes-neonbs-core.S +++ b/arch/arm64/crypto/aes-neonbs-core.S @@ -15,6 +15,7 @@ */ #include +#include #include .text @@ -620,12 +621,12 @@ SYM_FUNC_END(aesbs_decrypt8) .endm .align 4 -SYM_FUNC_START(aesbs_ecb_encrypt) +SYM_TYPED_FUNC_START(aesbs_ecb_encrypt) __ecb_crypt aesbs_encrypt8, v0, v1, v4, v6, v3, v7, v2, v5 SYM_FUNC_END(aesbs_ecb_encrypt) .align 4 -SYM_FUNC_START(aesbs_ecb_decrypt) +SYM_TYPED_FUNC_START(aesbs_ecb_decrypt) __ecb_crypt aesbs_decrypt8, v0, v1, v6, v4, v2, v7, v3, v5 SYM_FUNC_END(aesbs_ecb_decrypt) @@ -799,11 +800,11 @@ SYM_FUNC_END(__xts_crypt8) ret .endm -SYM_FUNC_START(aesbs_xts_encrypt) +SYM_TYPED_FUNC_START(aesbs_xts_encrypt) __xts_crypt aesbs_encrypt8, v0, v1, v4, v6, v3, v7, v2, v5 SYM_FUNC_END(aesbs_xts_encrypt) -SYM_FUNC_START(aesbs_xts_decrypt) +SYM_TYPED_FUNC_START(aesbs_xts_decrypt) __xts_crypt aesbs_decrypt8, v0, v1, v6, v4, v2, v7, v3, v5 SYM_FUNC_END(aesbs_xts_decrypt)