From patchwork Thu Mar 15 15:34:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 131803 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp1265694ljb; Thu, 15 Mar 2018 08:35:08 -0700 (PDT) X-Google-Smtp-Source: AG47ELuebysF6grHThx9DxgidvNeF5fRoNRnCIrSRLnJwv1a8zQ2/2kvBmQr4vEQIKqDKQ9aGci+ X-Received: by 10.99.132.72 with SMTP id k69mr7062946pgd.367.1521128107984; Thu, 15 Mar 2018 08:35:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521128107; cv=none; d=google.com; s=arc-20160816; b=BTxHEkYBv+5rcSDoIa3pt8r7So5rKMj5Yue1EZJ2mxQs6aY74K3SRoFDgORjlvLddH mABTy7AmMhPyU0WVBKdTL+z1w4FKh6w+NCU1/AjZgomlneqUTeGTdDff5LLo7VZImvpq xICsBL4ARmEbnM9MBYEgGPsC7AHqtaMSkRL/yM0urOrW0Ga9TXItZcdcA7D5hUtlhLwN zOVCd7fhuKqq8ErrSqQl7xUvUtEeba5pcOjXG/b+FwvYhw1BU6dLV4AfabLvc4bpNauq ZHygSctnL+GPeGVtw4EkwTFrJc+aQGS5wnzR/UoXMc+iABAjrXVwY2S3yXj1zh9TrA0O gIgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Yliog6dV/5cL8pgOd2KYgOKdKjdpsGMnEVH+bJYVPgc=; b=ryjOyPpVpzVv+olbO9ocHqb++PlA13iIZ1DnDU2Sz6GyEm3m0LZDM3xzc3tWwMlOJ/ 5rSoRqNM69KiMzD6Ndw9NOawZTkkYrgZth9fcdfbQI+WAMGfUyvZOalpFKClWEsZBFmi PNqgeobLQUq0fzD7vlNi7d7xbtwRvhs3n20zUQ3q7/nfP3p4KvbmDT20MBFmSyLBLYeA dswxqRfGq/X50VVA7ibqx2s6BPt1075/pujQj/sBrSMIvrtdShhzRVlCXXsqceOT3ZGj S//ib++hTAYvd5gI6CTq955Oj3NNaKR8MnpmPbFbyJjgABIoFOeJ7OYGH3k8RFAsyRgw JA3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t25si3560760pge.714.2018.03.15.08.35.07; Thu, 15 Mar 2018 08:35:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752722AbeCOPfE (ORCPT + 28 others); Thu, 15 Mar 2018 11:35:04 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:53621 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752172AbeCOPfD (ORCPT ); Thu, 15 Mar 2018 11:35:03 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue006 [212.227.15.129]) with ESMTPA (Nemesis) id 0M8tDM-1eme4e3wxI-00C9Hu; Thu, 15 Mar 2018 16:34:37 +0100 From: Arnd Bergmann To: Kees Cook , Anton Vorontsov , Colin Cross , Tony Luck Cc: Arnd Bergmann , Geliang Tang , Al Viro , Thomas Gleixner , Hirofumi Nakagawa , Yang Shi , linux-kernel@vger.kernel.org Subject: [PATCH] pstore: fix crypto dependencies Date: Thu, 15 Mar 2018 16:34:08 +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XrGE6uDV20nUk2axDGJxe Y7nDjO2putd49pjsdj8Ylhz2x/OjdCCOqGO+9Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The new crypto API use causes some problems with Kconfig dependencies, including this link error: fs/pstore/platform.o: In function `pstore_register': platform.c:(.text+0x248): undefined reference to `crypto_has_alg' platform.c:(.text+0x2a0): undefined reference to `crypto_alloc_base' fs/pstore/platform.o: In function `pstore_unregister': platform.c:(.text+0x498): undefined reference to `crypto_destroy_tfm' crypto/lz4hc.o: In function `lz4hc_sdecompress': lz4hc.c:(.text+0x1a): undefined reference to `LZ4_decompress_safe' crypto/lz4hc.o: In function `lz4hc_decompress_crypto': lz4hc.c:(.text+0x5a): undefined reference to `LZ4_decompress_safe' crypto/lz4hc.o: In function `lz4hc_scompress': lz4hc.c:(.text+0xaa): undefined reference to `LZ4_compress_HC' crypto/lz4hc.o: In function `lz4hc_mod_init': lz4hc.c:(.init.text+0xf): undefined reference to `crypto_register_alg' lz4hc.c:(.init.text+0x1f): undefined reference to `crypto_register_scomp' lz4hc.c:(.init.text+0x2f): undefined reference to `crypto_unregister_alg' The problem is that with CONFIG_CRYPTO=m, we must not 'select CRYPTO_LZ4' from a bool symbol, or call crypto API functions from a built-in module. This turns the sub-options into 'tristate' ones so the dependencies are honored, and makes the pstore itself select the crypto core if necessary. Fixes: cb3bee0369bc ("pstore: Use crypto compress API") Signed-off-by: Arnd Bergmann --- fs/pstore/Kconfig | 19 ++++++++++--------- fs/pstore/platform.c | 22 +++++++++++----------- 2 files changed, 21 insertions(+), 20 deletions(-) -- 2.9.0 diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig index 49b407eab846..09c19ef91526 100644 --- a/fs/pstore/Kconfig +++ b/fs/pstore/Kconfig @@ -1,5 +1,6 @@ config PSTORE tristate "Persistent store support" + select CRYPTO if PSTORE_COMPRESS default n help This option enables generic access to platform level @@ -13,7 +14,7 @@ config PSTORE say N. config PSTORE_DEFLATE_COMPRESS - bool "DEFLATE (ZLIB) compression" + tristate "DEFLATE (ZLIB) compression" default y depends on PSTORE select CRYPTO_DEFLATE @@ -22,21 +23,21 @@ config PSTORE_DEFLATE_COMPRESS algorithm support. config PSTORE_LZO_COMPRESS - bool "LZO compression" + tristate "LZO compression" depends on PSTORE select CRYPTO_LZO help This option enables LZO compression algorithm support. config PSTORE_LZ4_COMPRESS - bool "LZ4 compression" + tristate "LZ4 compression" depends on PSTORE select CRYPTO_LZ4 help This option enables LZ4 compression algorithm support. config PSTORE_LZ4HC_COMPRESS - bool "LZ4HC compression" + tristate "LZ4HC compression" depends on PSTORE select CRYPTO_LZ4HC help @@ -70,19 +71,19 @@ choice The default compression algorithm is deflate. config PSTORE_DEFLATE_COMPRESS_DEFAULT - bool "deflate" if PSTORE_DEFLATE_COMPRESS=y + bool "deflate" if PSTORE_DEFLATE_COMPRESS config PSTORE_LZO_COMPRESS_DEFAULT - bool "lzo" if PSTORE_LZO_COMPRESS=y + bool "lzo" if PSTORE_LZO_COMPRESS config PSTORE_LZ4_COMPRESS_DEFAULT - bool "lz4" if PSTORE_LZ4_COMPRESS=y + bool "lz4" if PSTORE_LZ4_COMPRESS config PSTORE_LZ4HC_COMPRESS_DEFAULT - bool "lz4hc" if PSTORE_LZ4HC_COMPRESS=y + bool "lz4hc" if PSTORE_LZ4HC_COMPRESS config PSTORE_842_COMPRESS_DEFAULT - bool "842" if PSTORE_842_COMPRESS=y + bool "842" if PSTORE_842_COMPRESS endchoice diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 42e111b3bd0c..1143ef351c58 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -28,10 +28,10 @@ #include #include #include -#ifdef CONFIG_PSTORE_LZO_COMPRESS +#if IS_ENABLED(CONFIG_PSTORE_LZO_COMPRESS) #include #endif -#if defined(CONFIG_PSTORE_LZ4_COMPRESS) || defined(CONFIG_PSTORE_LZ4HC_COMPRESS) +#if IS_ENABLED(CONFIG_PSTORE_LZ4_COMPRESS) || IS_ENABLED(CONFIG_PSTORE_LZ4HC_COMPRESS) #include #endif #include @@ -142,7 +142,7 @@ bool pstore_cannot_block_path(enum kmsg_dump_reason reason) } EXPORT_SYMBOL_GPL(pstore_cannot_block_path); -#ifdef CONFIG_PSTORE_DEFLATE_COMPRESS +#if IS_ENABLED(CONFIG_PSTORE_DEFLATE_COMPRESS) static int zbufsize_deflate(size_t size) { size_t cmpr; @@ -171,21 +171,21 @@ static int zbufsize_deflate(size_t size) } #endif -#ifdef CONFIG_PSTORE_LZO_COMPRESS +#if IS_ENABLED(CONFIG_PSTORE_LZO_COMPRESS) static int zbufsize_lzo(size_t size) { return lzo1x_worst_compress(size); } #endif -#if defined(CONFIG_PSTORE_LZ4_COMPRESS) || defined(CONFIG_PSTORE_LZ4HC_COMPRESS) +#if IS_ENABLED(CONFIG_PSTORE_LZ4_COMPRESS) || IS_ENABLED(CONFIG_PSTORE_LZ4HC_COMPRESS) static int zbufsize_lz4(size_t size) { return LZ4_compressBound(size); } #endif -#ifdef CONFIG_PSTORE_842_COMPRESS +#if IS_ENABLED(CONFIG_PSTORE_842_COMPRESS) static int zbufsize_842(size_t size) { return size; @@ -195,31 +195,31 @@ static int zbufsize_842(size_t size) static const struct pstore_zbackend *zbackend __ro_after_init; static const struct pstore_zbackend zbackends[] = { -#ifdef CONFIG_PSTORE_DEFLATE_COMPRESS +#if IS_ENABLED(CONFIG_PSTORE_DEFLATE_COMPRESS) { .zbufsize = zbufsize_deflate, .name = "deflate", }, #endif -#ifdef CONFIG_PSTORE_LZO_COMPRESS +#if IS_ENABLED(CONFIG_PSTORE_LZO_COMPRESS) { .zbufsize = zbufsize_lzo, .name = "lzo", }, #endif -#ifdef CONFIG_PSTORE_LZ4_COMPRESS +#if IS_ENABLED(CONFIG_PSTORE_LZ4_COMPRESS) { .zbufsize = zbufsize_lz4, .name = "lz4", }, #endif -#ifdef CONFIG_PSTORE_LZ4HC_COMPRESS +#if IS_ENABLED(CONFIG_PSTORE_LZ4HC_COMPRESS) { .zbufsize = zbufsize_lz4, .name = "lz4hc", }, #endif -#ifdef CONFIG_PSTORE_842_COMPRESS +#if IS_ENABLED(CONFIG_PSTORE_842_COMPRESS) { .zbufsize = zbufsize_842, .name = "842",