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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B8B0C433F5 for ; Wed, 27 Apr 2022 04:29:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357697AbiD0Ecc (ORCPT ); Wed, 27 Apr 2022 00:32:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357703AbiD0Ec0 (ORCPT ); Wed, 27 Apr 2022 00:32:26 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 579BC15A42A for ; Tue, 26 Apr 2022 21:29:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651033752; x=1682569752; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=yW17vhjAX+KHvuIhettnF8RnqJyy8HRkyKBPxatDtgo=; b=L2b7ei4xByGXe3rUbS3RjtBPkbviWSP2EL+CrwUDM8D9+D2ibKSQM3l7 HzCVRAzwrDM4xF+uWY9ZssL+d5iYpPXwm90i0voiv91/FJKx/AzdqxEp5 OFctkT6zOAe5CeLmmGeRAvPg/J1G1eCvJlz827VDzeqXwLv46nabpVCav UunDdAx2wD2bL/ySbT31ghyiADuqyUISEt/pq3vDXqrsUarHlY6IU0fvz 709UEpg7PDC8Kj/3zVUguwB999+DvgNb4BXIGPfZLEwS0doc15ZPGoDTw mNqBXp5pilEWnno0m3oSo7DIlOM5Q5zUGa5xtCMxMQNsfivbeoYpWVcHw g==; X-IronPort-AV: E=McAfee;i="6400,9594,10329"; a="263399596" X-IronPort-AV: E=Sophos;i="5.90,292,1643702400"; d="scan'208";a="263399596" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2022 21:28:05 -0700 X-IronPort-AV: E=Sophos;i="5.90,292,1643702400"; d="scan'208";a="730601853" Received: from aliang-mobl3.amr.corp.intel.com (HELO khuang2-desk.gar.corp.intel.com) ([10.254.1.170]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2022 21:28:02 -0700 Message-ID: Subject: Re: [PATCH v4 1/3] x86/tdx: Add TDX Guest attestation interface driver From: Kai Huang To: Sathyanarayanan Kuppuswamy , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org Cc: "H . Peter Anvin" , "Kirill A . Shutemov" , Tony Luck , Andi Kleen , linux-kernel@vger.kernel.org Date: Wed, 27 Apr 2022 16:28:00 +1200 In-Reply-To: <405a4f3c-3d49-f3c2-441b-8d8b9d5eec23@linux.intel.com> References: <20220422233418.1203092-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20220422233418.1203092-2-sathyanarayanan.kuppuswamy@linux.intel.com> <0457ce8e78ddd1d6c7832176368e095adae1bc18.camel@intel.com> <405a4f3c-3d49-f3c2-441b-8d8b9d5eec23@linux.intel.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-1.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > How about the following summary? It includes important notes mentioned > by you and some more driver info. Yes fine to me, except minor comments below: > > x86/tdx: Add TDX Guest attestation interface driver > > In TDX guest, attestation is used to verify the trustworthiness of a TD > to other entities before provisioning secrets to the TD. > > One usage example is, when a TD guest uses encrypted drive and if the > decryption keys required to access the drive are stored in a secure 3rd > party key server, the key server can use attestation to verify TD's > trustworthiness and release the decryption keys to the TD. > > The attestation process consists of two steps: TDREPORT generation and > Quote generation. > > TDREPORT (TDREPORT_STRUCT) is a fixed-size data structure generated by > the TDX module which contains TD-specific information (such as TD > measurements), platform security version, and the MAC to protect the > integrity of the TDREPORT. The TD kernel uses TDCALL[TDG.MR.REPORT] to > get the TDREPORT from the TDX module. A user-provided 64-Byte > REPORTDATA is used as input and included in the TDREPORT. Typically it > can be some nonce provided by attestation service so the TDREPORT can > be verified uniquely. More details about TDREPORT can be found in > Intel TDX Module specification, section titled "TDG.MR.REPORT Leaf". > > After getting the TDREPORT, the second step of the attestation process > is to send the TDREPORT to Quoting Enclave (QE) or Quote Generation > Service (QGS) to generate the Quote. However, the method of sending the > TDREPORT to QE/QGS, communication channel used and data format used is > specific to the implementation of QE/QGS. > > A typical implementation is, TD userspace attestation software gets the > TDREPORT from TD kernel, sends it to QE/QGS, and QE/QGS returns the > Quote. TD attestation software can use any available communication > channel to talk to QE/QGS, such as using vsock and tcp/ip. > > To support the case that those communication channels are not directly > available to the TD, TDX also defines TDVMCALL > (TDG.VP.VMCALL) to allow TD to ask VMM to help with sending > the TDREPORT and receiving the Quote. This support is documented in the > GHCI spec section titled "5.4 TD attestation". I intentionally omitted to mention TDG.VP.VMCALL as I personally believe there are still couple issues around GetQuote that we haven't discussed thoroughly (timeout, etc). I am still considering whether we should change GHCI to use TDG.VP.VMCALL defined in GHCI 1.5 for attestation. And the name of TDVMCALL doesn't actually matter here, so I think we don't need to mention GetQuote here but just say we have TDVMCALLs for that. > > Implement a basic attestation driver to allow TD userspace to get the > TDREPORT, which is sent to QE by the attestation software to generate > a Quote for remote verification. Add a wrapper function > (tdx_mcall_tdreport()) to get the TDREPORT from the TDX Module. This > API will be used by the interface driver to request for TDREPORT. I don't think you need to mention tdx_mcall_tdreport(). > > Also note that explicit access permissions are not enforced in this > driver because the quote and measurements are not a secret. However > the access permissions of the device node can be used to set any > desired access policy. The udev default is usually root access > only. > > > >