Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp491865rwe; Fri, 26 Aug 2022 08:39:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR4n/oCWjR7rydu6+rs9t42tryuBqdgyH370RlT2XqwLYrFetbfwPCdiCUpqGfsRqq7DgOgT X-Received: by 2002:a17:906:4795:b0:73d:d6e8:52a7 with SMTP id cw21-20020a170906479500b0073dd6e852a7mr4585887ejc.59.1661528375330; Fri, 26 Aug 2022 08:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661528375; cv=none; d=google.com; s=arc-20160816; b=gGuHIy9qt8OruPQpoSV/gJ1mO38HGYJr1KmY2HjCHp6RzThRc13kVL+3Uymn/Qtcd4 ltJlV1xbLL9IpOj+JOkv99d1uU/8Qg6jUUqoTlVuuM9f2FZszPuUl0drhIwaBrzJNkHT pmiaClPXp042sIhUbj71rgriwadYEGMYbxF+Dcc2QVVOW0Gt+7ZnvN1zfSBs9B2s0EOr O8ozjXsVJ27k4rk4giB0KXWwoFnE8IrReHl/vdel4JoKKe3aQMzZNRDYTK5s+hHZXXrp crpU8uYqQuFZFtFah76Ar+yrIs8QwXMLRaOx0WUoV1wSRkbmZr0sWNKtGExW8W6D+1D4 BitA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=b93scrgaiQ0oz/Ym6FrrI2NBGcimGMJ5FzYpyR2whrk=; b=M7c8n3O0tI6z0f30I8Kk9tj+AIW44YRmTAhsvwYYV7SQdnKlTAoqjUI0nH9ojWOkHq VlIXi0yM1fE/CvtC5yyeCb1Y1pgzc5ELvc0PLDTgSpOI0DBY0/UuemTIa/AhDtBbKP+5 Jbzkxsc2Prdjzel0A7WcYXpYxDZXOTc66sMWXn47lsJzsjaNBwI8q5Zek+5YDrNw4ozq y1DI+QLTYGXJ2zmfXI8S+E0Z8Vl99ktJNeqJ5Wapbm+/N1hVBzE+Tov01aVB6DRr0Erv pxBlSGFyAowVcJ3zKlvNh9m02TqoOLQaqHwvI6REQlU0MWD1S7T+pr7YpprjwiO+li3i LLjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lWERTVUn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw7-20020a170906478700b0073d8ba5a9e6si1442789ejc.879.2022.08.26.08.39.09; Fri, 26 Aug 2022 08:39:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lWERTVUn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233529AbiHZPHC (ORCPT + 99 others); Fri, 26 Aug 2022 11:07:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234995AbiHZPGw (ORCPT ); Fri, 26 Aug 2022 11:06:52 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4DAFC2752; Fri, 26 Aug 2022 08:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661526411; x=1693062411; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=INGF51T/yQRsWlGJI8AAwxkVAWj1/XyBWfVntWZFiNc=; b=lWERTVUnrRhvvOc19kIuP7lzrh59YXKqGTFvL05tmX2SOxHOu9n4ekcV 7aPz2PCm8lwBoe1qJj7fgX6q22r6lgCVkP7NEKnSbXHf6HTWyLIQ9HJlm WISSLr6TRsn1xlTb23eZF70GFK1i5ybqpTFZCAyx0w1VsAFfpBo3fchiV kXx0p5YlImSBxSnzAkPLhD6lcbuf4beu5PDRokJJ/ic5X2NNeQBhFPIIp yyLiVxviMERO5E/q4jqxjRGGUPSiVNC6nTVtIhqnSTK1/Kl76ClL4WUGX lejA9aKisAsj1hkwfwR0lYcAt3zYd5m1Pn2w73iTDdcSFgVdl5G33NAer A==; X-IronPort-AV: E=McAfee;i="6500,9779,10451"; a="277537974" X-IronPort-AV: E=Sophos;i="5.93,265,1654585200"; d="scan'208";a="277537974" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Aug 2022 08:06:49 -0700 X-IronPort-AV: E=Sophos;i="5.93,265,1654585200"; d="scan'208";a="678889600" Received: from kimdavid-mobl.amr.corp.intel.com (HELO skuppusw-desk1.amr.corp.intel.com) ([10.252.129.184]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Aug 2022 08:06:48 -0700 From: Kuppuswamy Sathyanarayanan To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Shuah Khan Cc: "H . Peter Anvin" , Greg Kroah-Hartman , Kuppuswamy Sathyanarayanan , "Kirill A . Shutemov" , Tony Luck , Andi Kleen , Kai Huang , Wander Lairson Costa , Isaku Yamahata , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v11 3/3] Documentation/x86: Document TDX attestation process Date: Fri, 26 Aug 2022 08:06:38 -0700 Message-Id: <20220826150638.2397576-3-sathyanarayanan.kuppuswamy@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220826150638.2397576-1-sathyanarayanan.kuppuswamy@linux.intel.com> References: <20220826150638.2397576-1-sathyanarayanan.kuppuswamy@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Document details about TDX attestation process and related user API support. Attestation details can be found in Guest-Host-Communication Interface (GHCI) for Intel Trust Domain Extensions (TDX), section titled "TD attestation". Signed-off-by: Kuppuswamy Sathyanarayanan --- Documentation/x86/tdx.rst | 75 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/Documentation/x86/tdx.rst b/Documentation/x86/tdx.rst index b8fa4329e1a5..45db1201b624 100644 --- a/Documentation/x86/tdx.rst +++ b/Documentation/x86/tdx.rst @@ -210,6 +210,81 @@ converted to shared on boot. For coherent DMA allocation, the DMA buffer gets converted on the allocation. Check force_dma_unencrypted() for details. +Attestation +=========== + +Attestation is used to verify the TDX guest trustworthiness to other +entities before provisioning secrets to the guest. For example, a key +server may request for attestation before releasing the encryption keys +to mount the encrypted rootfs or secondary drive. + +TDX module records the state of the TDX guest in various stages of guest +boot process using build time measurement register (MRTD) and runtime +measurement registers (RTMR). Measurements related to guest initial +configuration and firmware image is recorded in the MRTD register. +Measurements related to initial state, kernel image, firmware image, +command line options, initrd, ACPI tables, etc are recorded in RTMR +registers. For more details, please refer to TDX Virtual Firmware design +specification, sec titled "TD Measurement". + +At TDX guest runtime, the Intel TDX module reuses the Intel SGX attestation +infrastructure to provide support for attesting to these measurements as +described below. + +The attestation process consists of two steps: TDREPORT generation and +Quote generation. + +TDX guest uses TDCALL[TDG.MR.REPORT] to get the TDREPORT (TDREPORT_STRUCT) +from the TDX module. TDREPORT is a fixed-size data structure generated by +the TDX module which contains guest-specific information (such as build +and boot measurements), platform security version, and the MAC to protect +the integrity of the TDREPORT. + +After getting the TDREPORT, the second step of the attestation process +is to send it to the QE to generate the Quote. TDREPORT by design can only +be verified on local platform as the MAC key is bound to the platform. To +support remote verification of the TDREPORT, TDX leverages Intel SGX Quote +Enclave (QE) to verify the TDREPORT locally and convert it to a remote +verifiable Quote. Method of sending TDREPORT to QE is implemenentation +specific. Attestation software can choose whatever communication channel +available (i.e. vsock or hypercall) to send the TDREPORT to QE and receive +the Quote. + +To allow userspace attestation agent get the TDREPORT, TDX guest driver +exposes an IOCTL (TDX_CMD_GET_REPORT) interface via /dev/tdx-guest misc +device. + +TDX Guest driver +================ + +The TDX guest driver exposes IOCTL interfaces via /dev/tdx-guest misc +device to allow user space to get certain TDX guest specific details +(like attestation report, attestation quote or storage keys, etc). + +In this section, for each supported IOCTL, following information is +provided along with generic description. + +Input parameters: Parameters passed to the IOCTL and related details. +Output : Details about output data and return value (with details + about the non common error values). + +TDX_CMD_GET_REPORT +------------------ + +:Input parameters: struct tdx_report_req +:Output : Upon successful execution, TDREPORT data is copied to + tdx_report_req.tdreport and returns 0 or returns + -EIO on TDCALL failure and standard error number on + other common failures. + +The TDX_CMD_GET_REPORT IOCTL can be used by the attestation software to +get the TDX guest measurements data (with few other info) in the format +of TDREPORT_STRUCT. It uses TDCALL[TDG.MR.REPORT] to get the TDREPORT +from the TDX Module. + +Format of TDREPORT_STRUCT can be found in TDX 1.0 Module specification, +sec titled "TDREPORT_STRUCT". + References ========== -- 2.25.1