Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4433260ioa; Wed, 27 Apr 2022 03:53:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzP/U4ntic0TJNYEpssw48t3qXRYOr26ZFRf0biCwZrPjiPTDSDQI7XegGBDD60YuzAvvJr X-Received: by 2002:a17:90a:710c:b0:1d9:bf09:7004 with SMTP id h12-20020a17090a710c00b001d9bf097004mr7237578pjk.220.1651056825130; Wed, 27 Apr 2022 03:53:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651056825; cv=none; d=google.com; s=arc-20160816; b=errXe3UGYXuZZnQQyTiXutuMIwmEafu4LbdYcYHXOZNUIepOKVL2WCHFZ7V7bxv142 VImsZ5M3nllDlMBNRh7Lqf5ldNwelEMPldkd/O2arBncb3gVwaPlUCMIVu1u1nyalVbL Avuxq7/pZvbb5BxnqA5tFF+Txx4FdEuY5j2eq1XwuVu8d79v1MUky2aRxGl6I7ndNClt jK+oPp3JbfodoOHvd/huauDAjgCPA6Hi79OGd8m4dC3DdQ6HaR2cjNbhBex1Ry+BrZJZ VSJ2xb+oxq4rm8FWfhPF8930zepT/dXskcZlNN4yWIqvYmmCOX+9dRFUM8DJWtX/4pBj 7tWQ== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=lzRoFy0Bl2gYyZgCM7XeOGH0frPDJAqYhMaQfJwy/C0=; b=i/i3DxejUCEph73VN3QvSPVAQGMZP5hcBoU3rnXTqCxhGd8pbo3uMB9QEZBxMK+KQA QvfH3kx0o/BRgvhHu3r4N8UkyHTjC5XeOBhdPDm9scf8QV7KFGXESd/4iYUk8kXsk9/p TtYXFe6q+8c5wQiMBkvu8Cr98JOi/dHD8qMoVcCh2LTt50yx3GJhYTo6Iv6sR/UNzd0t 7ywDJUvfgzM+bHJwKon6BJKxL32J+AdwCcnMMFKoMpK/BL0yMgBo5VKjM8iUT+6yaQ3w L5rJGaE57ZpcV3ZnVVRUESGJGBYxaviUK1FTANDe9gR0mDGf04NaYvufO9wAsJ69e7XC Wp0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=L2b7ei4x; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id oa13-20020a17090b1bcd00b001c7ba889590si5545028pjb.2.2022.04.27.03.53.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 03:53:45 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=L2b7ei4x; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ABEB92F22B3; Wed, 27 Apr 2022 02:59:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357691AbiD0Ecb (ORCPT + 99 others); Wed, 27 Apr 2022 00:32:31 -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 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 > > 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. > > > >