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=-7.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 105FBC433F5 for ; Thu, 16 Sep 2021 22:19:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5B6461251 for ; Thu, 16 Sep 2021 22:19:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240938AbhIPWVC (ORCPT ); Thu, 16 Sep 2021 18:21:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32603 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240963AbhIPWVB (ORCPT ); Thu, 16 Sep 2021 18:21:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631830780; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LNQZtZk5ThEEV8nRic1GVZzg3YqPdgzLNMNUtC2mm6g=; b=iH8NxDcV/4+OExkHPuTD+gJCSrNV3Z5GQTdynudIOMUEg6hu7+1YdzUcgyD/p/ypgFKDY4 4lb1M5Nz1by8ArVOGI85ZuGgPIYWj3arnxMuV6FdxVP3987HOGphDfpOAFtY5jGOeIuLmf ebE9nD+DkNHy9nbkqs1YOVsawHsq92c= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-443-Dy_LADkBNmysRyRpTdB3yA-1; Thu, 16 Sep 2021 18:19:37 -0400 X-MC-Unique: Dy_LADkBNmysRyRpTdB3yA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 113EF824FA7; Thu, 16 Sep 2021 22:19:34 +0000 (UTC) Received: from redhat.com (ovpn-112-133.phx2.redhat.com [10.3.112.133]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AADF319C79; Thu, 16 Sep 2021 22:19:24 +0000 (UTC) Date: Thu, 16 Sep 2021 18:19:22 -0400 From: Peter Jones To: Eric Snowberg Cc: keyrings@vger.kernel.org, linux-integrity@vger.kernel.org, zohar@linux.ibm.com, dhowells@redhat.com, dwmw2@infradead.org, herbert@gondor.apana.org.au, davem@davemloft.net, jarkko@kernel.org, jmorris@namei.org, serge@hallyn.com, keescook@chromium.org, gregkh@linuxfoundation.org, torvalds@linux-foundation.org, scott.branden@broadcom.com, weiyongjun1@huawei.com, nayna@linux.ibm.com, ebiggers@google.com, ardb@kernel.org, nramas@linux.microsoft.com, lszubowi@redhat.com, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-security-module@vger.kernel.org, James.Bottomley@HansenPartnership.com, konrad.wilk@oracle.com Subject: Re: [PATCH v6 12/13] integrity: Trust MOK keys if MokListTrustedRT found Message-ID: <20210916221922.xjplaobua2iss2bn@redhat.com> References: <20210914211416.34096-1-eric.snowberg@oracle.com> <20210914211416.34096-13-eric.snowberg@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210914211416.34096-13-eric.snowberg@oracle.com> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: keyrings@vger.kernel.org On Tue, Sep 14, 2021 at 05:14:15PM -0400, Eric Snowberg wrote: > +/* > + * Try to load the MokListTrustedRT UEFI variable to see if we should trust > + * the mok keys within the kernel. It is not an error if this variable > + * does not exist. If it does not exist, mok keys should not be trusted > + * within the machine keyring. > + */ > +static __init bool uefi_check_trust_mok_keys(void) > +{ > + efi_status_t status; > + unsigned int mtrust = 0; > + unsigned long size = sizeof(mtrust); > + efi_guid_t guid = EFI_SHIM_LOCK_GUID; > + u32 attr; > + > + status = efi.get_variable(L"MokListTrustedRT", &guid, &attr, &size, &mtrust); This should use efi_mokvar_entry_find("MokListTrustedRT") instead, similar to how load_moklist_certs() does. It's a *much* more reliable mechanism. We don't even need to fall back to checking for the variable, as any version of shim that populates this supports the config table method. -- Peter