Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2041852pxb; Fri, 17 Sep 2021 00:18:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyChAcyEQB/rmFmF5zdkFIW1fI6fwwir+fZyzWWvhaTH+t9VI57BxLz7JQw3L607fnDcNDy X-Received: by 2002:a05:6638:d03:: with SMTP id q3mr7640889jaj.64.1631863134034; Fri, 17 Sep 2021 00:18:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631863134; cv=none; d=google.com; s=arc-20160816; b=kgGFF+/pcS7v1HQuLTLWuYBLLbyV+V2xyMdOtjUE97IJpuZDxr6O1PVNPqGtNcH4Ql 2saN8fmQvTQg9ivf4mwNECwmLgYHqpHKFiiKarOxpUH6MEojv74ApH0nkrEOrcBYVPEX xX0J85s/65cEvGMxsmO3fF9rgTJUDq9yBM2Yaer+81bjk7naKRyf3RNVO7O0igbhwL9Z pp2pRtJjF9ZoVY8urV9aMU6F7l7TD1dqoiDkDuNbKhn1eHcGsRddsvl3arBZqorDvcRy xdQPxr/r+n3IL91za3V3G1sMBc8TePr7xPrPXuyaUdkquj5+O567lmIDwvcswPb/Y7xz zQOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=LNQZtZk5ThEEV8nRic1GVZzg3YqPdgzLNMNUtC2mm6g=; b=VqIvXFyKjWHRVXqPIS+1Gixs1398PmZy+e/JOgtfCzca83quGk+7H8gtgz9ocej5zr rn3AdD0DQjGz5HHfVLJsqNfNSqsVevE4tH2jTaVHe5Kc0GOA1QhdZ+cjDlbBc9zKPDjo WYB3zdYis+3EnYR4haB9+msVDXf9vBBiaM3eI0m9kANh4l8+ToRqtRmQI6WyNqvXhhnO c0q2hyoLL8xpKnrKEXP5BRZsu+WBqtwPaqFysD9D0itdt0/XWxt1i/BiFE+GJNV7U2cD ppEf+k8ysuwIpxXupab8jhfhLXOwrDKvwMGu7UAQ3Irbm2DjBNoej2t/7dSyCVV38FJ3 aceA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iH8NxDcV; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r17si6026708iov.104.2021.09.17.00.18.42; Fri, 17 Sep 2021 00:18:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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=@redhat.com header.s=mimecast20190719 header.b=iH8NxDcV; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240963AbhIPWVC (ORCPT + 99 others); Thu, 16 Sep 2021 18:21:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24933 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240961AbhIPWVB (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: linux-crypto@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