Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1047014rwb; Fri, 18 Nov 2022 11:55:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf4wPGvZ+m+61fWrdRN7EGvlRx358rs7tghsMLv3LjW5rA+ONPiwN52blKyrbJHNfgLVLPdv X-Received: by 2002:a17:906:1985:b0:7ad:d1ab:2431 with SMTP id g5-20020a170906198500b007add1ab2431mr6965123ejd.213.1668801301395; Fri, 18 Nov 2022 11:55:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668801301; cv=none; d=google.com; s=arc-20160816; b=g/pZoBaI89KrT/Z3GcdkHPGDE4iuO/GNYgzwaZ8qljUVbe+/x9Uofa8UHZfbEQutBD D6xKHVdPOxYHAtSbj7IakyhXBPMZm/R/wZGWkX762AjBxm669DMNdVFZsslcPHqE48gA bdToQiMXVGb2pzjHSmCNAzmrX0lOqNFXS6LYp0F6sBD83NhCsrq5LmPBcdQWP93toDKQ rfAk6LuBXCb6rdDznC8xmw5XwlTkkK2dmMO6b4nRfHh+m+ggt2zGOi9ztvPm8LiNqSlA 9rN2gHsJ/EBb/ChBPby5oAdoFTdFkpizNSu3pc6NRHUe4X3hjt9/OsKJ/8dtSuHGEDM1 66qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kiwgeGsVNdrh7YI6+86wGcmcoBIBo4/t/zxfTdRZoUc=; b=IzH4pV7N3MnktdJzFVPZz3qCueTyksoONSRerHdrVww6pKyLMzOdWXIrlrfvm6mR1X rE5dNpR3RnzxLSMAhT7NkoGPzUMh0EVMzB5TTB17NDdOOckqwig+RcB+zy6TUDz2yPjz FNCIFPPLy9gdRuSdf2mYdojt5Bzgbh3XBRLPrwefrYa9ERakR/6FdZOlFJMDKYoTep7k df88JzlBZk2maM+jsucgqgaZhv7tdWMeP24Zyu2q0AoYxH+FPJuY6GTQ6uPkBfIC2gGO ksSSGHTT+vZJp05RzgKPnE8+D4QZRcElp7uN6AYZA1wrd1kbMppDIh4T+WyvlqNAxq7x O/fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JjeVGn8n; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb11-20020a0564020d0b00b0043d00293d23si3996968edb.391.2022.11.18.11.54.37; Fri, 18 Nov 2022 11:55:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JjeVGn8n; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241316AbiKRTqh (ORCPT + 99 others); Fri, 18 Nov 2022 14:46:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235467AbiKRTq3 (ORCPT ); Fri, 18 Nov 2022 14:46:29 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B15E88CFFB for ; Fri, 18 Nov 2022 11:46:26 -0800 (PST) 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 4C4966277E for ; Fri, 18 Nov 2022 19:46:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED9CCC433D7; Fri, 18 Nov 2022 19:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668800786; bh=kMW+VagvP+m/FfoCh7s6tC3GVUtFQvTJqaIKESW1UH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JjeVGn8nldBI641WZBxQtxPLNepo8CQPS8YNSbUU43cGsQ3/2Ak+xN3DP1rAfDoEB JLzx4iADDlNubhwQTePqull+hV/RL/S6w1I6lt5C9kGxk5YI1DD4oAEW94eyE0hYLT ZAYE3smvPyy2nuJIh7wAUNwJk2etU9xN9S390jiSJC9A5VWDBKDWHdht9NHeSzRUl4 w5TVIhkvTvCg8a9vsG9SR7HKwc1MHeSpma80kkxCn7SKUgMAVp6OxkZLc33ifmiowD ySn88t/8XZEo950gVGmL5UkxFamcR0rGJA20hFtTe7n0DXetlJDzg8Lcv/bL3nFUd4 5iuZ5lz/Ji5Xg== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: x86@kernel.org, linux-arm-kernel@lists.infradead.org, Sami Tolvanen , "Peter Zijlstra (Intel)" Subject: [PATCH v2 07/12] crypto: x86/sm3 - fix possible crash with CFI enabled Date: Fri, 18 Nov 2022 11:44:16 -0800 Message-Id: <20221118194421.160414-8-ebiggers@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221118194421.160414-1-ebiggers@kernel.org> References: <20221118194421.160414-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Eric Biggers sm3_transform_avx() is called via indirect function calls. Therefore it needs to use SYM_TYPED_FUNC_START instead of SYM_FUNC_START to cause its type hash 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: ccace936eec7 ("x86: Add types to indirectly called assembly functions") Acked-by: Peter Zijlstra (Intel) Reviewed-by: Sami Tolvanen 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) -- 2.38.1