Received: from list by lists.gnu.org with archive (Exim 4.71) id 1dN4k1-0005as-Dp for mharc-grub-devel@gnu.org; Mon, 19 Jun 2017 18:01:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dN4jy-0005Yz-I4 for grub-devel@gnu.org; Mon, 19 Jun 2017 18:01:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dN4ju-00070n-C7 for grub-devel@gnu.org; Mon, 19 Jun 2017 18:01:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32792) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dN4ju-0006zk-3j for grub-devel@gnu.org; Mon, 19 Jun 2017 18:01:42 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF6EAC04B94F; Mon, 19 Jun 2017 22:01:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DF6EAC04B94F Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=javierm@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DF6EAC04B94F Received: from [10.36.116.87] (ovpn-116-87.ams2.redhat.com [10.36.116.87]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C0D318167; Mon, 19 Jun 2017 22:01:38 +0000 (UTC) Subject: Re: [PATCH 3/3] Core TPM support To: The development of GNU GRUB , Matthew Garrett References: <20170615002102.123757-1-mjg59@google.com> <20170615002102.123757-4-mjg59@google.com> <88a4eb73-a76b-0afe-c3d6-8be2a2fa0e2c@redhat.com> <20170619033851.GA18928@srcf.ucam.org> From: Javier Martinez Canillas Message-ID: Date: Tue, 20 Jun 2017 00:01:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <20170619033851.GA18928@srcf.ucam.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 19 Jun 2017 22:01:40 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jun 2017 22:01:47 -0000 On 06/19/2017 05:38 AM, Matthew Garrett wrote: > On Fri, Jun 16, 2017 at 03:51:38PM +0200, Javier Martinez Canillas wrote: > >> The TCG EFI Protocol Specification (rev 00.13, March 2016) mentions that the >> tdEFI_TCG2_BOOT_SERVICE_CAPABILITY StructureVersion Major and Minor should >> be checked to determine the EFI_TCG2_BOOT_SERVICE_CAPABILITY struct version. >> >> In fact, shim checks for this and instead use tdTREE_BOOT_SERVICE_CAPABILITY >> if Major == 1 && Minor == 0. The EFI firmware on my Lenovo X1 Carbon reports >> these values for the FW TPM2.0 so I first was expecting the code to fail. But >> it works and I now see that the structures layout are equal so doesn't matter. >> >> Do you think that we should be more strict on this? Or instead the shim code >> could be simplified as you did here and avoid distinguish between the two? > > There's an argument for improving the correctness of this, yeah. As you > say I don't think it actually makes any meaningful difference, but it'll > help anyone who's comparing it to the spec. > Ok. >> Have you looked at how to get the TPM2.0 event logs from Linux? The TCG EFI Protocol >> Specification mentions that all events generated after a EFI_TCG2_GET_EVENT_LOG call >> shall be stored in a EFI_CONFIGURATION_TABLE that could be retrieved by the OS before >> a call to ExitBootServices(). >> >> I see that shim calls GetEventLogs() to trigger this switch and your patch doesn't. >> But Linux still doesn't have support to lookup this table anyways, so I think it's OK. > > I think this is a bug in shim. The right place to do this is in the EFI > boot stub in the kernel - otherwise the kernel has to source this event > information from multiple locations. But now that it's out there, we'll > probably have to handle the configurationt able as well. > Agreed. Let's see how this could be handled once the kernel has support to get the logs from the EFI_TCG2_FINAL_EVENTS_TABLE and the TPM2 ACPI table. >> It's also mentioned in the TCG ACPI (1.2 rev 8, February 2017) and TCG PC Client PFP >> (rev 00.49, January 2017) specifications, that the TPM2 ACPI table has optional fields >> for the Log Area Start Address (LASA) and Log Area Minimum Length (LAML). So that would >> be similar to the TPM1.2 TCPA ACPI table. I guess Linux should need support for both? > > I really hope that there are no implementations where there's a > difference between the information in ACPI and any other source, but I > guess we'll find out. That's going to end up being a problem for the > kernel rather than grub, anyway. > Yes. I would guess that there are firmwares out there that are following the old specs, so not filling these new TPM2 LASA && LAML fields and instead storing the logs in the EFI_TCG2_FINAL_EVENTS_TABLE. But we can later find out what the firmwares are actually doing and as you said this is a problem for Linux and not grub2 anyways. I just asked in case you had already looked how to get the TPM2.0 event logs from the OS. Best regards, -- Javier Martinez Canillas Software Engineer - Desktop Hardware Enablement Red Hat