From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73393C3B189 for ; Thu, 13 Feb 2020 15:28:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 441BF2467B for ; Thu, 13 Feb 2020 15:28:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607736; bh=ugwuPXf6WghU5oJsdjNmcF1b0R0Cd4sUsD8gETy8zxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=1RBsBBqlZB5OtDt3dbqXo+tfZHWc4uFfEJ1tn2CthDhq7OcWMb1q8iimVCEMtQbYz F7Tbppw68uP0wy2dHTyM3Mg5jAnK9A/ElHTKybrlSiPTf7WQancuUxWzN1zcqGCHNM UVduP2nOAboM/E9dJYv9S+Qn6Aa0HsKLtPL8T8U0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729626AbgBMP2y (ORCPT ); Thu, 13 Feb 2020 10:28:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:57338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729618AbgBMP2y (ORCPT ); Thu, 13 Feb 2020 10:28:54 -0500 Received: from localhost (unknown [104.132.1.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BAF24222C2; Thu, 13 Feb 2020 15:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607733; bh=ugwuPXf6WghU5oJsdjNmcF1b0R0Cd4sUsD8gETy8zxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0EiUmmEN50J56iPkyH6tKy8Hb4D3V07E57vphCq4/ymaRZGD+djEmHhGg/dkkWY+F nXiEX6M6aoCJ0CPlQL3cwGBdENjWPJ9kz3gI9uOd3CVfTUz8LoMuP4l1UOViNKQP0L tKZ8/xHikUJ58xGgqBEiG0KKoBO13fBYvD6WPsLY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , Arnd Bergmann , Ard Biesheuvel , Herbert Xu Subject: [PATCH 5.5 084/120] crypto: arm/chacha - fix build failured when kernel mode NEON is disabled Date: Thu, 13 Feb 2020 07:21:20 -0800 Message-Id: <20200213151929.629202597@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213151901.039700531@linuxfoundation.org> References: <20200213151901.039700531@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ard Biesheuvel commit 0bc81767c5bd9d005fae1099fb39eb3688370cb1 upstream. When the ARM accelerated ChaCha driver is built as part of a configuration that has kernel mode NEON disabled, we expect the compiler to propagate the build time constant expression IS_ENABLED(CONFIG_KERNEL_MODE_NEON) in a way that eliminates all the cross-object references to the actual NEON routines, which allows the chacha-neon-core.o object to be omitted from the build entirely. Unfortunately, this fails to work as expected in some cases, and we may end up with a build error such as chacha-glue.c:(.text+0xc0): undefined reference to `chacha_4block_xor_neon' caused by the fact that chacha_doneon() has not been eliminated from the object code, even though it will never be called in practice. Let's fix this by adding some IS_ENABLED(CONFIG_KERNEL_MODE_NEON) tests that are not strictly needed from a logical point of view, but should help the compiler infer that the NEON code paths are unreachable in those cases. Fixes: b36d8c09e710c71f ("crypto: arm/chacha - remove dependency on generic ...") Reported-by: Russell King Cc: Arnd Bergmann Signed-off-by: Ard Biesheuvel Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- arch/arm/crypto/chacha-glue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/arm/crypto/chacha-glue.c +++ b/arch/arm/crypto/chacha-glue.c @@ -115,7 +115,7 @@ static int chacha_stream_xor(struct skci if (nbytes < walk.total) nbytes = round_down(nbytes, walk.stride); - if (!neon) { + if (!IS_ENABLED(CONFIG_KERNEL_MODE_NEON) || !neon) { chacha_doarm(walk.dst.virt.addr, walk.src.virt.addr, nbytes, state, ctx->nrounds); state[12] += DIV_ROUND_UP(nbytes, CHACHA_BLOCK_SIZE); @@ -159,7 +159,7 @@ static int do_xchacha(struct skcipher_re chacha_init_generic(state, ctx->key, req->iv); - if (!neon) { + if (!IS_ENABLED(CONFIG_KERNEL_MODE_NEON) || !neon) { hchacha_block_arm(state, subctx.key, ctx->nrounds); } else { kernel_neon_begin();