Erdem Aktas wrote:
On Mon, Jun 12, 2023 at 12:03 PM Dan Williams dan.j.williams@intel.com wrote:
[ add David, Brijesh, and Atish]
Kuppuswamy Sathyanarayanan wrote:
In TDX guest, the second stage of the attestation process is Quote generation. This process is required to convert the locally generated TDREPORT into a remotely verifiable Quote. It involves sending the TDREPORT data to a Quoting Enclave (QE) which will verify the integrity of the TDREPORT and sign it with an attestation key.
Intel's TDX attestation driver exposes TDX_CMD_GET_QUOTE IOCTL to allow the user agent to get the TD Quote.
Add a kernel selftest module to verify the Quote generation feature.
TD Quote generation involves following steps:
- Get the TDREPORT data using TDX_CMD_GET_REPORT IOCTL.
- Embed the TDREPORT data in quote buffer and request for quote generation via TDX_CMD_GET_QUOTE IOCTL request.
- Upon completion of the GetQuote request, check for non zero value in the status field of Quote header to make sure the generated quote is valid.
What this cover letter does not say is that this is adding another instance of the similar pattern as SNP_GET_REPORT.
Linux is best served when multiple vendors trying to do similar operations are brought together behind a common ABI. We see this in the history of wrangling SCSI vendors behind common interfaces.
Compared to the number of SCSI vendors, I think the number of CPU vendors for confidential computing seems manageable to me. Is this really a good comparison?
Fair enough, and prompted by this I talk a bit more about the motiviations and benefits of a Keys abstraction for attestation here:
https://lore.kernel.org/all/64961c3baf8ce_142af829436@dwillia2-xfh.jf.intel....
Now multiple confidential computing vendors trying to develop similar flows with differentiated formats where that differentiation need not leak over the ABI boundary.
<Just my personal opinion below> I agree with this statement in the high level but it is also somehow surprising for me after all the discussion happened around this topic. Honestly, I feel like there are multiple versions of "Intel" working in different directions.
This proposal was sent while firmly wearing my Linux community hat. I agree, the timing here is unfortunate.
If we want multiple vendors trying to do the similar things behind a common ABI, it should start with the spec. Since this comment is coming from Intel, I wonder if there is any plan to combine the GHCB and GHCI interfaces under common ABI in the future or why it did not even happen in the first place.
Per above comment about firmly wearing my Linux hat I am coming at this purely from the perspective of what do we do now as a community that continues to see these implementations proliferate and grow more features. Common specs are great, but I agree with you, it is too late for that, but I hope that as Linux asserts "this is what it should look like" it starts to influence future IP innovation, and attestation service providers, to acommodate the kernel's ABI momentum.
What I see is that Intel has GETQUOTE TDVMCALL interface in its spec and again Intel does not really want to provide support for it in linux. It feels really frustrating.
I am aware of how frustrating late feedback can be. I am also encouraged by some of the conversations and investigations that have already happened around how Keys fits what these attestation solutions need.
My observation of SNP_GET_REPORT and TDX_CMD_GET_REPORT is that they are both passing blobs across the user/kernel and platform/kernel boundary for the purposes of unlocking other resources. To me that is a flow that the Keys subsystem has infrastructure to handle. It has the concept of upcalls and asynchronous population of blobs by handles and mechanisms to protect and cache those communications. Linux / the Keys subsystem could benefit from the enhancements it would need to cover these 2 cases. Specifically, the benefit that when ARM and RISC-V arrive with similar communications with platform TSMs (Trusted Security Module) they can build upon the same infrastructure.
David, am I reaching with that association? My strawman mapping of TDX_CMD_GET_QUOTE to request_key() is something like:
request_key(coco_quote, "description", "<uuencoded tdreport>")
Where this is a common key_type for all vendors, but the description and arguments have room for vendor differentiation when doing the upcall to the platform TSM, but userspace never needs to contend with the different vendor formats, that is all handled internally to the kernel.
I think the problem definition here is not accurate. With AMD SNP, guests
need to do a hypercall to KVM and KVM needs to issue a SNP_GUEST_REQUEST(MSG_REPORT_REQ) to the SP firmware. In TDX, guests need to do a TDCALL to TDXMODULE to get the TDREPORT and then it needs to get that report delivered to the host userspace to get the TDQUOTE generated by the SGX quoting enclave. Also TDQUOTE is designed to work async while the SNP_GUEST_REQUESTS are blocking vmcalls.
Those are completely different flows. Are you suggesting that intel should also come down to a single call to get the TDQUOTE like AMD SNP?
The Keys subsystem supports async instantiation of key material with usermode upcalls if necessary. So I do not see a problem supporting these flows behind a common key type.
The TDCALL interface asking for the TDREPORT is already there. AMD does not need to ask the report and the quote separately.
Here, the problem was that Intel (upstream) did not want to implement hypercall for TDQUOTE which would be handled by the user space VMM. The alternative implementation (using vsock) does not work for many use cases including ours. I do not see how your suggestion addresses the problem that this patch was trying to solve.
Perhaps the strawman mockup makes it more clear:
https://lore.kernel.org/all/64961c3baf8ce_142af829436@dwillia2-xfh.jf.intel....
So while I like the suggested direction, I am not sure how much it is possible to come up with a common ABI even with just only for 2 vendors (AMD and Intel) without doing spec changes which is a multi year effort imho.
I agree, hardware spec changes are out of scope for this effort, but Keys might require some additional flows to be built up in the kernel that could be previously handled in userspace. I.e. the "bottom half" that I reference in the mockup.
This is something we went through with using "encrypted-keys" for nvdimm. Instead of an ioctl to inject a secret key over the user kernel boundary a key server need to store a serialized version of the encrypted key blob and pass that into the kernel.