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=-5.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 613F2C4727F for ; Fri, 25 Sep 2020 22:57:24 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B9E61208B6 for ; Fri, 25 Sep 2020 22:57:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=apertussolutions.com header.i=dpsmith@apertussolutions.com header.b="kQ0ksBHC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B9E61208B6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=apertussolutions.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 57F5386DD3; Fri, 25 Sep 2020 22:57:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XWQbVfTWq8yY; Fri, 25 Sep 2020 22:57:22 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 1257283EFE; Fri, 25 Sep 2020 22:57:22 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DA4C6C0891; Fri, 25 Sep 2020 22:57:21 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1CFBAC0051 for ; Fri, 25 Sep 2020 21:48:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 03E918768C for ; Fri, 25 Sep 2020 21:48:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tM9L2+I7q+XS for ; Fri, 25 Sep 2020 21:48:30 +0000 (UTC) X-Greylist: delayed 00:15:04 by SQLgrey-1.7.6 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by hemlock.osuosl.org (Postfix) with ESMTPS id D40548768B for ; Fri, 25 Sep 2020 21:48:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1601069575; cv=none; d=zohomail.com; s=zohoarc; b=eaCridq/Q/bPqSpnsGv/DJP6Af6/ncIr2v/Qf8j8EGiSN5pUxISglSxhg0elB/41ayTlI2YKZ8pZnWTFbUbJklfdDvQCOj8B0fCxdc8rh0XadT/UJzFBbCBU1yMRnp75hcbcVvAFC6+rbIJMARqR4sCb6zqH6qfj1yXd+406l5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601069575; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=0a7g0NVpSKP3n73d4Kbie2Bt3f9aurS3uIGDEm9zTs8=; b=dxw/TJwnUBKaP0P0ILY/i2BLJ4r+gYKey93bBzChSs3ax3+wOsVoWVYEAJ4MPJ4mtFCK4q+H/F2y2Vosr8QSSjCLtxSASL5crgyxTGAxjtArgWXQ6miEvlSiBDketKM5Y4nieFp7HmnDQaFTsqQPZqeL1nQ+J4+oZwlKXhfgDb4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1601069575; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=0a7g0NVpSKP3n73d4Kbie2Bt3f9aurS3uIGDEm9zTs8=; b=kQ0ksBHC73Nhf3QsqlgJGUOmpoeQQeVZL0cpPok5s92kAwdC/qZsEhhOqweVurav S7E5Gat7JVVnw6mD9i8b8EcmsiVW6ezfvE8uFH4GaK19nb7Na8qtR1cm3rvBTNPrlVp qc90V9VtyQo34Al/a6roBwy8NP/5tWpmOfVYMowA= Received: from [10.10.1.24] (c-73-129-147-140.hsd1.md.comcast.net [73.129.147.140]) by mx.zohomail.com with SMTPS id 1601069573615900.4080400133685; Fri, 25 Sep 2020 14:32:53 -0700 (PDT) Subject: Re: [PATCH 00/13] x86: Trenchboot secure dynamic launch Linux kernel support To: Jarkko Sakkinen References: <1600959521-24158-1-git-send-email-ross.philipson@oracle.com> <20200925053051.GA165011@linux.intel.com> From: "Daniel P. Smith" Message-ID: <8329607a-704d-1da0-dc7b-4b97c2440afb@apertussolutions.com> Autocrypt: addr=dpsmith@apertussolutions.com; prefer-encrypt=mutual; keydata= mQMuBFYrueARCACPWL3r2bCSI6TrkIE/aRzj4ksFYPzLkJbWLZGBRlv7HQLvs6i/K4y/b4fs JDq5eL4e9BdfdnZm/b+K+Gweyc0Px2poDWwKVTFFRgxKWq9R7McwNnvuZ4nyXJBVn7PT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: <20200925053051.GA165011@linux.intel.com> Content-Language: en-US X-ZohoMailClient: External X-Mailman-Approved-At: Fri, 25 Sep 2020 22:57:20 +0000 Cc: linux-doc@vger.kernel.org, Ross Philipson , x86@kernel.org, linux-kernel@vger.kernel.org, luto@amacapital.net, iommu@lists.linux-foundation.org, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, linux-integrity@vger.kernel.org, trenchboot-devel@googlegroups.com, tglx@linutronix.de X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On 9/25/20 1:30 AM, Jarkko Sakkinen wrote: > On Thu, Sep 24, 2020 at 10:58:28AM -0400, Ross Philipson wrote: >> The Trenchboot project focus on boot security has led to the enabling of >> the Linux kernel to be directly invocable by the x86 Dynamic Launch >> instruction(s) for establishing a Dynamic Root of Trust for Measurement >> (DRTM). The dynamic launch will be initiated by a boot loader with > > What is "the dynamic launch"? Dynamic launch is the term used to reference the event/process of restarting a system without reboot to establish the DRTM. It is defined in the TCG Glossary[1], is discussed in detail in the TCG D-RTM Architecture specification[2], and covered in minimal detail in sections 9.5.5 and 34.2 of the TCG TPM2.0 Architecture specification[3]. [1] https://trustedcomputinggroup.org/wp-content/uploads/TCG-Glossary-V1.1-Rev-1.0.pdf [2] https://trustedcomputinggroup.org/wp-content/uploads/TCG_D-RTM_Architecture_v1-0_Published_06172013.pdf [3] https://trustedcomputinggroup.org/wp-content/uploads/TCG_TPM2_r1p59_Part1_Architecture_pub.pdf >> associated support added to it, for example the first targeted boot >> loader will be GRUB2. An integral part of establishing the DRTM involves >> measuring everything that is intended to be run (kernel image, initrd, >> etc) and everything that will configure that kernel to run (command >> line, boot params, etc) into specific PCRs, the DRTM PCRs (17-22), in >> the TPM. Another key aspect is the dynamic launch is rooted in hardware, >> that is to say the hardware (CPU) is what takes the first measurement >> for the chain of integrity measurements. On Intel this is done using >> the GETSEC instruction provided by Intel's TXT and the SKINIT >> instruction provided by AMD's AMD-V. Information on these technologies >> can be readily found online. This patchset introduces Intel TXT support. > > Why not both Intel and AMD? You should explain this in the cover letter. The work for this is split across different teams with different resourcing levels resulting in one organization working Intel and another working AMD. This then raised the concern over submitting a single patch set developed by two groups pseudo-independently. In this situation the result would be patches being submitted from one organization that had no direct development or testing and therefore could not sign off on a subset of the patches being submitted. > I'd be more motivated to review and test a full all encompassing x86 > solution. It would increase the patch set size but would also give it > a better test coverage, which I think would be a huge plus in such a > complex patch set. We would not disagree with those sentiments but see the previous response about the conflict that exists. >> To enable the kernel to be launched by GETSEC, a stub must be built >> into the setup section of the compressed kernel to handle the specific >> state that the dynamic launch process leaves the BSP in. This is >> analogous to the EFI stub that is found in the same area. Also this stub > > How is it analogous? It is analogous as we used it as the pattern to follow for adding a configurable entry point to the kernel. There was a discussion on this when we published the RFC patches[4]. [4] https://lkml.org/lkml/2020/3/25/982 >> must measure everything that is going to be used as early as possible. >> This stub code and subsequent code must also deal with the specific >> state that the dynamic launch leaves the APs in. > > What is "the specific state"? The details are a bit more than I would prefer to explain here, I would recommend reading section 2.3 and 2.4 of Intel's TXT Software Development Guide[5] for all the details of the state and the prescribed initialization sequence. [5] https://www.intel.com/content/dam/www/public/us/en/documents/guides/intel-txt-software-development-guide.pdf >> A quick note on terminology. The larger open source project itself is >> called Trenchboot, which is hosted on Github (links below). The kernel >> feature enabling the use of the x86 technology is referred to as "Secure >> Launch" within the kernel code. As such the prefixes sl_/SL_ or >> slaunch/SLAUNCH will be seen in the code. The stub code discussed above >> is referred to as the SL stub. > > Is this only for Trenchboot? I'm a bit lost. What is it anyway? TrenchBoot is a meta-project that is working to bring a unified approach to using DRTM across CPU implementations and open source projects. Currently we are working to integrate a dynamic launch preamble (the code that sets up for calling the dynamic launch CPU instruction) in GRUB, building an open AMD Secure Loader that aligns with how Intel's SINIT ACM hands off to an MLE, bring the first directly launchable implementation to Linux (Secure Launch) with Xen being the next directly launchable implementation, providing the u-root project a secure launch initramfs init routine to demonstrate a policy driven measurement and attestation framework that can be used in conjunction with a Secure Launch kernel. >> The basic flow is: >> >> - Entry from the dynamic launch jumps to the SL stub >> - SL stub fixes up the world on the BSP > > What is "SL"? As mentioned above, it is just shorthand for Secure Launch. >> - For TXT, SL stub wakes the APs, fixes up their worlds >> - For TXT, APs are left halted waiting for an NMI to wake them >> - SL stub jumps to startup_32 >> - SL main runs to measure configuration and module information into the >> DRTM PCRs. It also locates the TPM event log. >> - Kernel boot proceeds normally from this point. >> - During early setup, slaunch_setup() runs to finish some validation >> and setup tasks. > > What are "some" validation and setup tasks? The validation and setup steps are to ensure the environment was setup in a manner that we expected as outlined in the Intel TXT Software Development guide[4]. At this point these are, - Ensure that SENTER completed successfully and was not initiated by TBOOT. - Check that the private MMIO register bank is available. - Fetch values needed from the TXT heap for later operations. - Verify the PMR values cover the MLE and other memory regions that need to be secure. - Reserve certain TXT specific areas of physical memory. - Fetch the copy of the DMAR table from the TXT heap to provide to the IOMMU driver later. >> - The SMP bringup code is modified to wake the waiting APs. APs vector >> to rmpiggy and start up normally from that point. >> - Kernel boot finishes booting normally >> - SL securityfs module is present to allow reading and writing of the >> TPM event log. > > What is SL securityfs module? Why is it needed? We already have > securityfs file for the event log. Why it needs to be writable? The securityfs nodes provides access to the TXT registers to inspect the details from the dynamic launch and access to the DRTM event log. The DRTM event log is setup by the DRTM process and is a different/separate event log from the SRTM/UEFI event log. We need write access for use cases where the Secure Launch kernel is being used as an intermediate launch kernel where additional measurements about the final target environment are being collected. >> - SEXIT support to leave SMX mode is present on the kexec path and >> the various reboot paths (poweroff, reset, halt). > > What SEXIT do and why it is required on the kexec path? The SEXIT instruction "exits" SMX mode. The why is because when in SMX mode the CPU has a set of behaviors different than what is typically expected, especially for SMP management. As good custodians, this ensures that the system is in a usable state for a follow-on kernel that is not SMX/Secure Launch aware. From a security use case perspective, leaving SMX mode disables access to localities 1-3 of the TPM. This essentially "locks" the values in the DRTM PCRs from further modification/extends until another dynamic launch event is fired which will in turn result in the DRTM PCRs being reset. > /Jarkko > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu