Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6652975pxv; Thu, 29 Jul 2021 21:56:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw673ZrM14nL0wrkNxC0aYcAsdI1dTKns7VZ9BuLTVrbwpEyYEneTs+k2PXY2Hkc3TxY/2p X-Received: by 2002:a05:6402:7da:: with SMTP id u26mr784542edy.270.1627620972994; Thu, 29 Jul 2021 21:56:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627620972; cv=none; d=google.com; s=arc-20160816; b=ZljEPdEl5++xFfAsyhAOGVVnz8LDoTEgLrBSdnt80MRz3Kh02ZMk4YRmV8LAa28SJl QoSzhsE3QasVqvYH163GsR4mSxCau2SPCYxfQ+JAe35Va1jdCgaQUWEHrghsnox+Kapg iFb6oyjf8LyKtmSV3rO97xprGULGvO/x0bITw3hJB/B9g1HU7I3Xg6cWnUCnbIgzgqlU UOx+vtbv4Lr/r41GcPfzZTrUmDEiN5il8dP2suvOVXxYIurnbb1EyWpe8Pjwapdux/6u nlqS493HArL0l5ZnZHDHQI+hcKHOwYPtd2vI34W0tfjCkjZEaagxrI1RdMttkh6Do8MV pJHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=26cLx9q8rosx/ecicZmvDaHKsvwoSzGuRC6wOLHJtNA=; b=cnV8/KS305gjRXOOAyMIXUUQpYXNWn3leetgG6rhpHE2GsbOPSBFwHp96irtVWphgE oFs+ZhDhWdA99rzgQCv50vBxY0aFHxCNTQa9tHGeqviSy9hOa5K1rHbZpdlBbYh6p6k7 Ja08CHaF3gOv5AInnCScjUjUh9yeTr41pg8BKwFr4SatQ/5E5gw3kGsdwZllJ9N5QIL9 Obn3igELNPJ3K2vGwUv+7ib3Pbpnprc1gSBO5S5ZmhtbPVuieO8Fl2R7yS+7YaNf/CNe BCfLwMZLr3s+3Qig35Lp0+qrx/CKR3umhbQISA178qcR/6hf9URibzmwZcB82OhuPuq6 FeIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yeXSbxyD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m5si560552edc.162.2021.07.29.21.55.49; Thu, 29 Jul 2021 21:56:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yeXSbxyD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230204AbhG3Eyc (ORCPT + 99 others); Fri, 30 Jul 2021 00:54:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbhG3Eya (ORCPT ); Fri, 30 Jul 2021 00:54:30 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12BD4C061765 for ; Thu, 29 Jul 2021 21:54:26 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id z2so15338951lft.1 for ; Thu, 29 Jul 2021 21:54:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=26cLx9q8rosx/ecicZmvDaHKsvwoSzGuRC6wOLHJtNA=; b=yeXSbxyDokjWczrODAJejItwOt0diRi24EVgseJepoyLiTGg0kPU35xi2yf5GagW6+ 3wG4Bau8c1dHU6UeYua5l5rfEbpGmvsoVlpSal5dvilE6nLhbFVN9Z73CVXoFV90KlQH RIUxRAT6Jt68PZxtDjlVNAce3gBCrjFNG+UFWJ4wYa9b3lUovEPEin/mmo+CoflEVYcT y2sOO3WKfJDF8dPmDiQIttBY63S/MbdfRCzZ1qSQN3x9ZjFBzK4N2pHRv0FnluYi18Sd AdulqBhQc6CkWdduK44cDMDUFVifP9JDps6RZ3YYwRkXoNtg28D7TK/BABEbt4mtnw+H zxPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=26cLx9q8rosx/ecicZmvDaHKsvwoSzGuRC6wOLHJtNA=; b=pQwQMxKN8s537+yyfwaHwaBcADVf2GVrm4ByplZs4dDZ0PMdzFUmx6UIgILq0r8Wt3 XzlBmajmfor2UOCL2LXjLYijWFs1K0QY0DnuqVYAc6iZpZXX/fxpr0XeCq+kEVh4drJ0 2jfMlD3PyIKjQ0Pdmo0Zpgh2CWdVgf/2hDoGGYR30SdzfSnyUNOrDSOREgLD/g3gbF0k kpLpgoD7HpEBnSNWK9JR7cUsHDBkrqYSQQ9I8Q+Xd4t3l5HTm10Z7CN7u14q9nJ2YpeP F2/IYeQFqOxihMygqsHVeZo+zsaHPH6T83P7VL3iFNtyI2nEDVRkhWCUb5dNV5ht/gTU GoRA== X-Gm-Message-State: AOAM53106azZXB5m3ZzYhOOkK7b7tONizl9Zv2G3dKyxXWhewYLxVAeZ N+PYoYflPUM3wHfbBEbO7x9ZozV0AJdQjNxUnTwYyQ== X-Received: by 2002:a19:6e0d:: with SMTP id j13mr459081lfc.108.1627620864329; Thu, 29 Jul 2021 21:54:24 -0700 (PDT) MIME-Version: 1.0 References: <20210730012822.3460913-1-andreas@rammhold.de> In-Reply-To: <20210730012822.3460913-1-andreas@rammhold.de> From: Sumit Garg Date: Fri, 30 Jul 2021 10:24:12 +0530 Message-ID: Subject: Re: [PATCH v3] KEYS: trusted: Fix trusted key backends when building as module To: Andreas Rammhold Cc: James Bottomley , Jarkko Sakkinen , Mimi Zohar , David Howells , James Morris , "Serge E. Hallyn" , Ahmad Fatoum , linux-integrity , "open list:ASYMMETRIC KEYS" , "open list:SECURITY SUBSYSTEM" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 30 Jul 2021 at 06:58, Andreas Rammhold wrote: > > 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_=E2=80=A6 preprocessor variable is defined we o= nly > test for the builtin (=3Dy) case and not the module (=3Dm) case. By using > the IS_REACHABLE() macro we do test for both cases. > > Fixes: 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework") > Signed-off-by: Andreas Rammhold > Reviewed-by: Jarkko Sakkinen > > --- > > v3: > * Fixed patch formatting > > v2: > * Fixed commit message > * Switched from IS_DEFINED() to IS_REACHABLE() > > security/keys/trusted-keys/trusted_core.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > LGTM. Reviewed-by: Sumit Garg -Sumit > diff --git a/security/keys/trusted-keys/trusted_core.c b/security/keys/tr= usted-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[] =3D { > -#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.32.0 >