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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 1A9D9C4338F for ; Fri, 30 Jul 2021 04:54:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E841F61019 for ; Fri, 30 Jul 2021 04:54:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230424AbhG3Eyc (ORCPT ); Fri, 30 Jul 2021 00:54:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230204AbhG3Eya (ORCPT ); Fri, 30 Jul 2021 00:54:30 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13BD9C0613CF for ; Thu, 29 Jul 2021 21:54:26 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id m13so15248709lfg.13 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=dI7gQq+4+HDgqlLGutx+T5dbhwRUVxMfA+yKufT2J0MhfRq6HWunD5kb3OkRKQe+Mm IEqqE6X6OWwG8R32CdcL/kZVCHqG2hkUhOigr8n/+eFXK3+Q0WRZAFBGG/uvdu9wPIMh MpmWpW57LdZb/SEt/R02VX6i7OzNgZtqgSoWt+GCQFL812lj1gHtrrJ+4YpL3k6TCE5f uLbOxt23Oxs9Ds33aRDz64Z6nZ/280+cDemeICKgRIWC7j2IdTN8IhUTJ0FUce6px6py 5CdLF2uqAUipLMTtCTPNGjRzvwB6w6wxCSwmImzqpSlooQo5Foq/vAm9/PfRmY6KWWi1 Y/Zw== X-Gm-Message-State: AOAM530aQGExFn94nR4XODASZNr+1pZVSDkz7lorAEgzjxF3p9j1j+DC 1tqGwqwP+cD3+08vy33TJfEg2qhe1C05afNcr+nNKg== X-Google-Smtp-Source: ABdhPJxWONtco8cudb0xi/7JqnX8J1mzvb8nmBW+OW7JqUn+9cAKU5U7NTUu+oYM9hY+mM/ySDySXyVichecYCRWqEE= 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: keyrings@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 >