From patchwork Fri Nov 18 09:02:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 13047876 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 A318EC4332F for ; Fri, 18 Nov 2022 09:06:33 +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=Wj7PXnPyMwIBlPNKJWXZh/DH0zRUR8yLD7J+hPVVcnI=; b=1T4UGTmynmqDXJ hW+AmfTLfwQ+TKquDDm9fpfms0ix/SyeLJwuRyLy9tcRQZIWliZdgN7FUwY3NJJXjF7obIH0sKcCW NLXpUXKqVl+FiT3B34rN5ybJob2qW8n9Zkyiv8wwq9f6MLIi6Q66DIWnk6BYrhJ+giFAN1bzvjUMU Rh6c4ADWbB/f/sMShw2mntL/VUSTQt0RJ2br5jtSN10UWEHjnmHLWcdgwB9hJZsb6Bnop3LeulH7Q YshsvML7sYrbX2DfVbDn9m6bo0Lzdo/dYKpqk9frQduYQdE9e4dBNTSBIuS29ehe+cyPF9hley0xi nOjdIHOdFZbQIL5KBHgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovxJO-002wNf-J4; Fri, 18 Nov 2022 09:05:27 +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-002vvl-RP for linux-arm-kernel@lists.infradead.org; Fri, 18 Nov 2022 09:04:13 +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 89D7F623BF; Fri, 18 Nov 2022 09:04:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CE0BC433D6; 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=NnbwjD/ex8fXbifBK9kxmybIvw2mJxpjvji26vXujDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jCfMsnWwuLZr2TZMX42ziZkf9YQUI/Z7eUjtM7+vmN99cHpcGLu8BoyYZNKSin29Q fGxnshtgoc/9/yDLFLEvCqu+dmCY44y3gUTofehfryzsGicymkxlJRvWcOzafSe7bR O+0+aHnGVahABEPC8PVOdy6wUJmDMFaMs3SG+yzlzgmtg9chTFSU5PY1zqX3oE6rn0 HdtJBfAadfp4QGOozG5olUgrRaR/UzcUM8rx+AQ7bFrPrWMzygCCcJWZ+WCj7WiEag xGkZ2t7gmMPfzrRqraVIdDjSncz8/T2PdRKGzXB65iuxcp2jE92LWeR3TAePTE2GgF +AvIqUqoixt4w== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: x86@kernel.org, linux-arm-kernel@lists.infradead.org, Sami Tolvanen Subject: [PATCH 07/11] crypto: x86/sm3 - fix possible crash with CFI enabled Date: Fri, 18 Nov 2022 01:02:16 -0800 Message-Id: <20221118090220.398819-8-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_003372_D4275E96 X-CRM114-Status: GOOD ( 13.47 ) 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_transform_avx() 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: 3c516f89e17e ("x86: Add support for CONFIG_CFI_CLANG") Signed-off-by: Eric Biggers --- arch/x86/crypto/sm3-avx-asm_64.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/crypto/sm3-avx-asm_64.S b/arch/x86/crypto/sm3-avx-asm_64.S index b12b9efb5ec51..8fc5ac681fd63 100644 --- a/arch/x86/crypto/sm3-avx-asm_64.S +++ b/arch/x86/crypto/sm3-avx-asm_64.S @@ -12,6 +12,7 @@ */ #include +#include #include /* Context structure */ @@ -328,7 +329,7 @@ * const u8 *data, int nblocks); */ .align 16 -SYM_FUNC_START(sm3_transform_avx) +SYM_TYPED_FUNC_START(sm3_transform_avx) /* input: * %rdi: ctx, CTX * %rsi: data (64*nblks bytes)