Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp605859pxb; Tue, 5 Apr 2022 15:44:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwmeZNsWCKOPjQMabcSR5Z8IVkKk6mEi5fdgAnEDPwR/Mt6UtqNili2tB2jdWHA5FJQ2AE X-Received: by 2002:a17:90b:4f44:b0:1c7:9f03:9b2d with SMTP id pj4-20020a17090b4f4400b001c79f039b2dmr6652502pjb.24.1649198650267; Tue, 05 Apr 2022 15:44:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649198650; cv=none; d=google.com; s=arc-20160816; b=ET8jBtyAIp7QbFwAnflDUI/RHVCtRMaIYnh8Q53z/TyPcyUWczMRlN+mmxm65cF+QQ zLQK4CYRrg6rCjkJi5bWucInyjruP0n+PGWo/r6QcEfIlhEfIGaU4C5ahoXbh9QWMvO1 2xtrInw7fbp/jCpfn7HhZptkrcdfV0tSZqFXqMGxYjGLb2U9DL1IQc3BNMm2uoSaPBjF CykBR9sc4M9zQmbCCNeGCAhMLoRmoXU+7MLySiKjYpQIQMxMBN6EIiIp6LBfCIvkt/KS hQeLzK0Or9lnPUkTYumU4DfMapR1wLIlHsAQwOrEnDHjvu5CVTtyN1vL9aQ/yqlaxaYp SfQg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kTGqpED8n3jhO8F0sRJc+rXgUWGCd/9Dr3KcVUgXk78=; b=0dxr6swruZdMnmZz+tAHmT+YxzOC3FT9DlPgFWjuvxQrEhotGt4RDtTCvVIUHfAy+5 thwvSKnRPp51mVfE0+eMCmSk8WwaeiHmORMqjD7/P4B5KTUVlyNkjD3TIRMnEXanYE4D 5Kei5TajOFmjg95d/iV+ygE1ANxa7Jncz8OjK5HsI98YarR+uZMpV/issl6Fn/nDW4ZV vMEkHGNJjHlibX30Rc9ZzWXMj8TCvTjUwzJDUPbrBWSGfmgkrZcHEZMt/RpwIy1Aej6d 3ezjmIftvtJA5kzVy3RFQ4CKZqHjsTOuuZwvnJOf+X7CYinCwIcP7f06B6HVxhEY+aDV kFaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ENaom5Yi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f17-20020a637551000000b003989594cac1si13937952pgn.632.2022.04.05.15.44.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 15:44:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ENaom5Yi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AC07072458; Tue, 5 Apr 2022 15:24:32 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344083AbiDEPKq (ORCPT + 99 others); Tue, 5 Apr 2022 11:10:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345706AbiDEJnt (ORCPT ); Tue, 5 Apr 2022 05:43:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FD22C4E2F; Tue, 5 Apr 2022 02:28:58 -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 ams.source.kernel.org (Postfix) with ESMTPS id E98AEB81CAE; Tue, 5 Apr 2022 09:28:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60471C385A3; Tue, 5 Apr 2022 09:28:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649150935; bh=KRNK4njVsHVBRUVwoLTSxSdSTi/Wg8AxT7cHVB6pSlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ENaom5YincphP6p+n+kSZE9DVY9YJibAf4zuO77HBWXEDnZaBpnR+F0SveK9syKk9 MVaRxFnpVqpOTrmVE96tkwGmJ8E00ERF2RHCfohBQMyJWFCYP/Gfwdyve7ZWkmfuQw aLvaBMWK2sk4zGz2D/vBIJnewgW0IwHwPO7TTMDY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jarkko Sakkinen , Ahmad Fatoum , Sumit Garg , Andreas Rammhold , Sasha Levin Subject: [PATCH 5.15 234/913] KEYS: trusted: Fix trusted key backends when building as module Date: Tue, 5 Apr 2022 09:21:36 +0200 Message-Id: <20220405070346.869676721@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Andreas Rammhold [ Upstream commit 969a26446bcd142faedfe8c6f41cd7668596c1fa ] Before this commit the kernel could end up with no trusted key sources even though both of the currently supported backends (TPM and TEE) were compiled as modules. This manifested in the trusted key type not being registered at all. When checking if a CONFIG_… preprocessor variable is defined we only test for the builtin (=y) case and not the module (=m) case. By using the IS_REACHABLE() macro we do test for both cases. Fixes: 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework") Reviewed-by: Jarkko Sakkinen Reviewed-by: Ahmad Fatoum Reviewed-by: Sumit Garg Signed-off-by: Andreas Rammhold Tested-by: Ahmad Fatoum Signed-off-by: Ahmad Fatoum Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin --- security/keys/trusted-keys/trusted_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/keys/trusted-keys/trusted_core.c b/security/keys/trusted-keys/trusted_core.c index d5c891d8d353..5b35f1b87644 100644 --- a/security/keys/trusted-keys/trusted_core.c +++ b/security/keys/trusted-keys/trusted_core.c @@ -27,10 +27,10 @@ module_param_named(source, trusted_key_source, charp, 0); MODULE_PARM_DESC(source, "Select trusted keys source (tpm or tee)"); static const struct trusted_key_source trusted_key_sources[] = { -#if defined(CONFIG_TCG_TPM) +#if IS_REACHABLE(CONFIG_TCG_TPM) { "tpm", &trusted_key_tpm_ops }, #endif -#if defined(CONFIG_TEE) +#if IS_REACHABLE(CONFIG_TEE) { "tee", &trusted_key_tee_ops }, #endif }; -- 2.34.1