Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1042311rwb; Fri, 18 Nov 2022 11:49:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf42iNVxlOxMz2I3ZR+AZEDNNNb4pHlV6a2PnUvWoY/OpkuF5thqy12y5fULsNzpSNoZNGKI X-Received: by 2002:a63:4746:0:b0:46e:beb0:9d2c with SMTP id w6-20020a634746000000b0046ebeb09d2cmr8148863pgk.117.1668800979069; Fri, 18 Nov 2022 11:49:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668800979; cv=none; d=google.com; s=arc-20160816; b=Y8KOTdyoMmC9V0wyRFPWwh3iTzyVwW8QobO7vRG1jmJjYakonGTk3gHTc2ej46BGqW 17ckqBymNlmN4MqE0tIQOtIfrYBo8wEncuOz84eXPQcI386BU2ygXSNtKBY8EEd6qiNj rnVRAAH0N/4fISFutupXKFqTeJ5a6Mwc5nNM0r4svpnVQWJ53erfd7Pxm06/tUNHrvMs iYAvFU9hwJyJFdNpzIU2kFIF44y/JizWvdpNwlNFF9vjfGQ9DcoP7SEw3L0YGnHn7oE7 ggujPskpocU9OEPpDcQEfI4dxxuGurFb+W+utWsgXwGXJaCyJFRoe8+vQUGL/rVYXxB2 4K6g== 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=tVe3OhIdGWGIYBQfBiK8HiOdN6TvMNfkbJlPK0YqTYY=; b=B+stj/Z6c+dqwf2VBQh8boX8dkW+ocsoCDZSzHYlC8muHbOEfrLqrK4WlIH674lq/K aau6RqnT4S2v0YPKmOVBHmhjL+kWcEy9McLHsn9d5oxSH/n3xo1Ii5Avw8O8KzX3dMFt xkCgSxUJCMSndHhFAq8by3RlSmtrLuik2vHvr8X9Xy/T88o0lH54v3cZpombebYKwUMc 0Bbh0R6n2SJnL4vxg8S+TaeG+IeW7zIx8hTelJQNnhEMylxmTl38Z/JiNF64SYC1f+QM nEjnEiCRqTCG3/w5z5+uGUxvQ42ZWDbYdJ2YLwqt/NrP/XplVX9d8ORo0Sac8XjLGBiM 4Irw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SvwBQUsI; 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 b9-20020a655cc9000000b004769410323fsi4400436pgt.820.2022.11.18.11.49.25; Fri, 18 Nov 2022 11:49:39 -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=SvwBQUsI; 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 S235220AbiKRTqo (ORCPT + 99 others); Fri, 18 Nov 2022 14:46:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235594AbiKRTqb (ORCPT ); Fri, 18 Nov 2022 14:46:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E1F08CFDE for ; Fri, 18 Nov 2022 11:46:29 -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 ams.source.kernel.org (Postfix) with ESMTPS id 50C1CB824C8 for ; Fri, 18 Nov 2022 19:46:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D64BCC433B5; Fri, 18 Nov 2022 19:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668800787; bh=502XtfzzJCvn41Ye4mf8jH8Z9XzhNMTzAZtoz+ow1Mk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SvwBQUsI23XQ04sTI+nMVJ/WdNE5SRFV0xg5sQjzZmEWJ1B+c7rFPuO1rZ6ZiApwe oN0DQyrJnBsRXkaoO9X8r3laLNge0EW+fgfc6La6YGGQKvYuLZobjj3n8AkCMhC8mf gOpZJOhwNEVzfBoL7N5xSXxS6HEVgx6G/y5WmkR3LGvn79IeLRXprShuZwm2R4cnRB G8PqvC13bsWK+9I4PZkHV/TLQhlxmBxO7JVrraQ7AwrR5n2+PHMp5YwEAsTxy55WQw VT6e73YReQNO5UW1oa5/5CTixIuDmDQIHWoGgQiiMGWEe7EVzdvKrUIl6Kw8W45yry I5s/S5nTK7/1g== 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 10/12] crypto: arm64/sm3 - fix possible crash with CFI enabled Date: Fri, 18 Nov 2022 11:44:19 -0800 Message-Id: <20221118194421.160414-11-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_neon_transform() 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: c50d32859e70 ("arm64: Add types to indirect called assembly functions") Acked-by: Peter Zijlstra (Intel) Reviewed-by: Sami Tolvanen Signed-off-by: Eric Biggers --- arch/arm64/crypto/sm3-neon-core.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/crypto/sm3-neon-core.S b/arch/arm64/crypto/sm3-neon-core.S index 3e3b4e5c736fc..4357e0e51be38 100644 --- a/arch/arm64/crypto/sm3-neon-core.S +++ b/arch/arm64/crypto/sm3-neon-core.S @@ -9,6 +9,7 @@ */ #include +#include #include /* Context structure */ @@ -351,7 +352,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] -- 2.38.1