Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1075625rwb; Fri, 18 Nov 2022 12:21:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf5XXFcUhNaV5dcEJTUH7rVb9TLSwM+MQ/v+2osxIifZXvqtqC1nAjJXSL7/4AQvFvs7y6og X-Received: by 2002:a62:5f46:0:b0:56b:cc74:4bd5 with SMTP id t67-20020a625f46000000b0056bcc744bd5mr9507258pfb.79.1668802888557; Fri, 18 Nov 2022 12:21:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668802888; cv=none; d=google.com; s=arc-20160816; b=MaGKKYC1k2EJdA4x21d2vJuB4yykEMfbT2i8jwfL1pe3ytQh4aS9r3ouz4Ms2qg1dA yvtyrB8z5zd7EXaLgf94fuU/DppD9VQ0qqz53Re/Qgwvp7wgexAUpGeR/Puv5RF0MIav krkOr/xiZrCWZOfodA62mJtHJ2+MKyeLD9gWzcIsXFwfjbhOK4jdHQpvE0ECTFpQwkpP DBCaIZk9/sf5SHWAk4awej4z9NNdjhFEpFG6Cc1Z1/kujtc1BHlFiYW4U9Ibz2ivBN+8 5CeGZ/Sl3RLCaLcp0j/dQpeSnorzuZbQy1QeOuEoQoIdDwD2SeToT4S4r18DI2nreCZF iI6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/8Jli9lrOU0VJAeC7QXDSe4c19Te3QQJRh4s+c+Y/pY=; b=RYtTs06Bkin5Ak1hdVSJWwnxitmnWst2+OQs1l4PGiCcthzUukdh59ceJ6MqqazoA3 iwxPbRfTyJTAxtwlabkTi0/ZhT6J1QDXRd/q05Kusgu+2fIk0sYZ45cSflNVM7SiFtv2 ggizQxqFGyJa0F+zBBiDpU5gd1JKRyS78pZB+hE7iJDAIRDbZAzpaBb6iHyn2VQHMv06 gdJHWa2VImN9j9MwMtCH30pSIUTaiymOaBd6gB787S5s/oPuWJhTNk5m/b/pZCpwXK1h 6YZb+QepLZHf2aIeHaNAD/YS5TNRX42f1XHqeiiWDBXB0mGZf3+UWXYlf9tfenhAqyxu ivjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dY0pogli; 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 v7-20020a62a507000000b0056b8f6cd527si4092764pfm.61.2022.11.18.12.21.05; Fri, 18 Nov 2022 12:21:28 -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=dY0pogli; 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 S230223AbiKRUKi (ORCPT + 99 others); Fri, 18 Nov 2022 15:10:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230494AbiKRUKc (ORCPT ); Fri, 18 Nov 2022 15:10:32 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 890AB21825 for ; Fri, 18 Nov 2022 12:10:31 -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 30387B82519 for ; Fri, 18 Nov 2022 20:10:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99655C433D6; Fri, 18 Nov 2022 20:10:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668802228; bh=g15ZgYIyqqNcWivqUSAPRmX9RwX9KtdnWWwsroGLpB4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dY0poglitAuL6oX65nW17ZRSUcrUf7Lh2egtvRB17q91ikFzAeCqKYD5teJ5h7vHS AH4Pmu8RrJFTU5FW9mh0RwvwNia5IlP7yNNe5sYwzzikYxmxC7UvS2fx7Ozlca49Yi VL8FQh6hIO8gMcInwprkXZqVKQo7n6QpXuV3B2YN0SGIy9V+pT1N1xojrVX6Yslsz9 /j/WW0sM2KCTeFYBtbweciYvctODMylX859uyyMkcZHklZ5W1id3nrvoXDQOq3zYne I7ea8j1kTiKGMel9AGiYe/DQ79fa4sAE1NAMwgE8jY/mWEp2A3diQ1t3VUkiC10KDs 5LG67XzlYRnMg== Date: Fri, 18 Nov 2022 12:10:26 -0800 From: Eric Biggers To: Sami Tolvanen Cc: x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org Subject: Re: [PATCH v2 08/12] crypto: x86/sm4 - fix crash with CFI enabled Message-ID: References: <20221118194421.160414-1-ebiggers@kernel.org> <20221118194421.160414-9-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221118194421.160414-9-ebiggers@kernel.org> 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 On Fri, Nov 18, 2022 at 11:44:17AM -0800, Eric Biggers wrote: > From: Eric Biggers > > sm4_aesni_avx_ctr_enc_blk8(), sm4_aesni_avx_cbc_dec_blk8(), > sm4_aesni_avx_cfb_dec_blk8(), sm4_aesni_avx2_ctr_enc_blk16(), > sm4_aesni_avx2_cbc_dec_blk16(), and sm4_aesni_avx2_cfb_dec_blk16() 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. > > (Or at least that should be the case. For some reason the CFI checks in > sm4_avx_cbc_decrypt(), sm4_avx_cfb_decrypt(), and sm4_avx_ctr_crypt() > are not always being generated, using current tip-of-tree clang. > Anyway, this patch is a good idea anyway.) Sami, is it expected that a CFI check isn't being generated for the indirect call to 'func' in sm4_avx_cbc_decrypt()? I'm using LLVM commit 4a7be42d922af0. - Eric