From patchwork Fri Apr 14 08:03:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 83283 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp218419vqo; Fri, 14 Apr 2023 01:24:40 -0700 (PDT) X-Google-Smtp-Source: AKy350bpINgderKdAtUKBihHmJcgsaj/i1Ina+Qszk2XIFPqL307CBfeSV7Symkx+XTedizfbu2p X-Received: by 2002:a05:6a00:1992:b0:63b:3567:8d74 with SMTP id d18-20020a056a00199200b0063b35678d74mr7278653pfl.7.1681460679811; Fri, 14 Apr 2023 01:24:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681460679; cv=none; d=google.com; s=arc-20160816; b=Dkijhr9mLiT6brp5dyeunHfNREXuKQ1dG+hjOjLlqd6hHQtiFBES8qMNoC/mz6cv4W kobJG/8+/qupUt5EHmLggL7HfOSjnuktGXiFtYHIlvhjyg52oPQKz72m5m0kUyfeTkUn S5ipgsa364Y+L+MiGKp92OPA9nLQvU7MZxALM209TewFbEi/ie8zdeZ418BwV6UtSwZP UsniH/sEiH3O0Wjo0rUF0YT9C23E5C/j4O+P+V4stMa1cLrTfard8p+zuFo/W7aaT1sv AqIZ4OFs/waZAwFhSsOvEzbwNLmjUReJH3LOB+4UfnWfFEb1cGjZo/06HfpAp8xwG4hY VqOg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=7hYGrZb3xc4NtFrCZ3q+ghLLNOyeDSZGMoyREIjMhOM=; b=axIlE5Iet3ulFwm/y9Ke7PB7xlX/8/pjAbtkxAdPiUgNJVEoqpiwT1p5uPmBbs3XRt BudvYHZTmY5I3WzlR8lEMnody/M6EE2tIqAvMfzZuO3BEGXABOn5dtG2obSHDDRduAx5 9clSuLP9/wTO09f828NHJT4Rk5JjBCn7PtsLziOt65kBINhCitBx8bk9NqkjjxZxm8Z0 cs1qs2QbTwKD8Zh/RKksobVLvgcFjin5UQhkqshkZuLUjCbBezUFzpWxwbwfEbeiF6MA 5jg2aq+a1treYXLPbCFRSMOKcZYxZPG86NEtMYqprn1QJ6eIM1a4/pXXTMy5J1CV3115 rB7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="V/uwUPy9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y29-20020aa7943d000000b0063b1bfa94dfsi3685511pfo.301.2023.04.14.01.24.27; Fri, 14 Apr 2023 01:24:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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="V/uwUPy9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S229716AbjDNIDk (ORCPT + 99 others); Fri, 14 Apr 2023 04:03:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbjDNIDj (ORCPT ); Fri, 14 Apr 2023 04:03:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECAA410DB; Fri, 14 Apr 2023 01:03:36 -0700 (PDT) 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 8150061509; Fri, 14 Apr 2023 08:03:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FEA1C433EF; Fri, 14 Apr 2023 08:03:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681459415; bh=A/hvv45Iuk0V5ALA824dIubPvLgUljKnosLa3dg0EbI=; h=From:To:Cc:Subject:Date:From; b=V/uwUPy98/cFW554EfKlf6cexw08ln3C2B5ofLE9nOvQezv/KhEjJbYIQrjQMccQO v3x7hoEOJPfEQipk5f+ghSpMXXToj/wKRGF3+m5rRVLcDbZMHGsqpOPo16l34CCPKZ NkxueHB8RY0GL7qEcegiYKsDPK9q+jGy/gVezoh/AeQqgSJWJsI3JXn6WSl8Y4xqop Qp5B8SSowKiZOHth0iAxZWcPHVCjv8gZ/IvKwSZnr1+E3dem3zY2ZnqWKGIaZ6VGId XFYWMCscrvH9wGgiMTtdlte0jJBlajO/5v15A1EQnV5rDK1AOjk/9M9OgMlG0gSvMI Je2lDSIUh6crQ== From: Arnd Bergmann To: Luis Chamberlain , Russ Weight Cc: linux-crypto@vger.kernel.org, Herbert Xu , Arnd Bergmann , Greg Kroah-Hartman , "Rafael J. Wysocki" , Tianfei zhang , Cezary Rojewski , =?utf-8?q?Amadeusz_S=C5=82awi?= =?utf-8?q?=C5=84ski?= , Takashi Iwai , linux-kernel@vger.kernel.org Subject: [PATCH] firmware_loader: rework crypto dependencies Date: Fri, 14 Apr 2023 10:03:07 +0200 Message-Id: <20230414080329.76176-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763139313926157259?= X-GMAIL-MSGID: =?utf-8?q?1763139313926157259?= From: Arnd Bergmann The crypto dependencies for the firmwware loader are incomplete, in particular a built-in FW_LOADER fails to link against a modular crypto hash driver: ld.lld: error: undefined symbol: crypto_alloc_shash ld.lld: error: undefined symbol: crypto_shash_digest ld.lld: error: undefined symbol: crypto_destroy_tfm >>> referenced by main.c >>> drivers/base/firmware_loader/main.o:(fw_log_firmware_info) in archive vmlinux.a Rework this to use the usual 'select' from the driver module, to respect the built-in vs module dependencies, and add a more verbose crypto dependency to the debug option to prevent configurations that lead to a link failure. Fixes: 02fe26f25325 ("firmware_loader: Add debug message with checksum for FW file") Signed-off-by: Arnd Bergmann Acked-by: Herbert Xu Reviewed-by: Amadeusz Sławiński Acked-by: Luis Chamberlain --- Tested on a few hundred randconfig builds --- drivers/base/firmware_loader/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/base/firmware_loader/Kconfig b/drivers/base/firmware_loader/Kconfig index 0cabc783d67a..5ca00e02fe82 100644 --- a/drivers/base/firmware_loader/Kconfig +++ b/drivers/base/firmware_loader/Kconfig @@ -3,6 +3,8 @@ menu "Firmware loader" config FW_LOADER tristate "Firmware loading facility" if EXPERT + select CRYPTO_HASH if FW_LOADER_DEBUG + select CRYPTO_SHA256 if FW_LOADER_DEBUG default y help This enables the firmware loading facility in the kernel. The kernel @@ -26,10 +28,9 @@ config FW_LOADER config FW_LOADER_DEBUG bool "Log filenames and checksums for loaded firmware" + depends on CRYPTO = FW_LOADER || CRYPTO=y depends on DYNAMIC_DEBUG depends on FW_LOADER - depends on CRYPTO - depends on CRYPTO_SHA256 default FW_LOADER help Select this option to use dynamic debug to log firmware filenames and