Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp11672923rwd; Thu, 22 Jun 2023 17:14:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6r2aYe+eyoGWrTLOjXDBArg1zRWikX4ORhzq/JVbl8XMghAo0stw6GpK4OKvs/fICJ2SAM X-Received: by 2002:a05:6a00:1913:b0:668:7292:b2c2 with SMTP id y19-20020a056a00191300b006687292b2c2mr11992395pfi.2.1687479254111; Thu, 22 Jun 2023 17:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687479254; cv=none; d=google.com; s=arc-20160816; b=gm628NL8wt2mkEM8EIzNGO2dqFqvLV+ffDtpRhb/eNuyg3pfXo/Pdo2lQ0L3yexRfp 9cXUIu/sx0yIR0+D8Z854ThBU3UKtN2FGLMBOHq9FyxFlwWxrR8BGcwr0gccjwwLqqWT 2aB2di6uMGqViBrD/GNDv7by4BXspFgovA/3+D5cgw5BmdnhT3n2ZwzEGImosRutFv06 QVKhCYgtK6niBp8Be7SamMMnewMIY0ikgBtfbSQB5/YtVVshrDMj8LQLqSRa6OWlJqs+ ZgZjzFcj3l3HhXR5e+pFpoj/j2R49WOGUcChlNFOcO5fwUhRN3K9B3SdzsV7NIeuoymt nxpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=67piO5m5kwhgkGZRSCs+P2mt8JZPTPY6ZNmz3uFEERw=; b=IwDO2CoJO/rp+2jhYCzxAu2XRaIEJgzVYzOLcdM3FQbSKVIVE01kpBrI9NlngeLh5Q T4/XApWTVkGvszUgbxe/kTJJxkLeiB+7BobQJPFjA7B2aAACjHn0f5XTBfeGH1umSW8S STl8P9JMXAHv+EaVTDd/O1HkS2eJ7BUAMeTdJZLbS1yz+ceZLRNP6W+K19OepzGuKXgU czNcBuhAM3V2NcRGzfl1rCyz4oreSa4gfXwT/3LnkQspRiXl16pEy1uzRq/IRJp8xq5S k8QRIwCHTn7Tm+mn9SwjIuwlPakynXczYXYUyAqlSo+HmPoD5szqJy2clA9f2gMXk7YU 8z+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=Go9OPZrC; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y28-20020aa78f3c000000b0064d3e651979si7114182pfr.233.2023.06.22.17.14.01; Thu, 22 Jun 2023 17:14:14 -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=@google.com header.s=20221208 header.b=Go9OPZrC; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230503AbjFVXcA (ORCPT + 99 others); Thu, 22 Jun 2023 19:32:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229934AbjFVXb6 (ORCPT ); Thu, 22 Jun 2023 19:31:58 -0400 Received: from mail-vk1-xa2e.google.com (mail-vk1-xa2e.google.com [IPv6:2607:f8b0:4864:20::a2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3168C210A for ; Thu, 22 Jun 2023 16:31:57 -0700 (PDT) Received: by mail-vk1-xa2e.google.com with SMTP id 71dfb90a1353d-47167a4ce3cso28441e0c.2 for ; Thu, 22 Jun 2023 16:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687476716; x=1690068716; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=67piO5m5kwhgkGZRSCs+P2mt8JZPTPY6ZNmz3uFEERw=; b=Go9OPZrCjyYQrsGYmeyjij/CYhyZz00UzA7dWA9yE65QecRbdBxLjHb3CHXsjMLhgE cHOBEJyeVN5chDlUh00cwig04AbPvMnUmLiS7c9iR1pFC2dRjvhIpHnbmq112EW1f9th WR2cmAM8Al8Q/WbPfSwc0vJl4NkTl7vLJYvpqHo7KYa3tyErj29HOJ4HsFNergrI31U2 MJVW/Czc3AdfmGXsRk2YmM+QXV9rh5kaUf0eNvt6cqbat9Y92TT4V6CKZQLD3s6s5B4n Le0KRFp7o6I6fiA26eSskq/Vr+AvyD7atFVXYPMv1bm+lDSdRpl0sVOnNORrJSb1C1um QB4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687476716; x=1690068716; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=67piO5m5kwhgkGZRSCs+P2mt8JZPTPY6ZNmz3uFEERw=; b=gdksEbzvSiFRe87VY3aHOrOduLtd7E/N4CKEyiFY85d/gtZBygO2wJZ+tgZhcy3xCX 2cO1KmZSv8/9wESEjUiQPXNFWE17KyGwzId3333nHOXc8nKTN683+ezjPo85lx520Z1R GAeth5T7E/Fr1/aKSZTNWlQHfeH9rRt/CO+fQKwDDCthJPWGJM8uG7ru/MQhs2nRBeAK 7X6ozJGLtlbhOTAkvMga6XS4ndm/pBv51YJY40DDHNKEZiFPwstTGT11Won8hKYZxr4t y0/txtb0u8LM3FipwM72XoGyMv0+pevBqMhgUNcFZheOVjixX+rJZqWM9FDKjPHjzypF FNBw== X-Gm-Message-State: AC+VfDxO19XNVl5WgANXzsvri6Kct7JdJJ2bNCUviqAMcDUIqcdFFu2d 3D0fs6cM2rBg9SUOOSxpkoJbGt+gfWGry74eNPcv+w== X-Received: by 2002:a1f:5744:0:b0:471:5110:49e8 with SMTP id l65-20020a1f5744000000b00471511049e8mr9920922vkb.4.1687476714680; Thu, 22 Jun 2023 16:31:54 -0700 (PDT) MIME-Version: 1.0 References: <972e1d5c5ec53e2757fb17a586558c5385e987dd.1684048511.git.sathyanarayanan.kuppuswamy@linux.intel.com> <64876bf6c30e2_1433ac29415@dwillia2-xfh.jf.intel.com.notmuch> In-Reply-To: <64876bf6c30e2_1433ac29415@dwillia2-xfh.jf.intel.com.notmuch> From: Erdem Aktas Date: Thu, 22 Jun 2023 16:31:43 -0700 Message-ID: Subject: Re: [PATCH v3 3/3] selftests/tdx: Test GetQuote TDX attestation feature To: Dan Williams Cc: Kuppuswamy Sathyanarayanan , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Shuah Khan , Jonathan Corbet , "H . Peter Anvin" , "Kirill A . Shutemov" , Tony Luck , Wander Lairson Costa , Dionna Amalie Glaze , Chong Cai , Qinkun Bao , Guorui Yu , Du Fan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, dhowells@redhat.com, brijesh.singh@amd.com, atishp@rivosinc.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On Mon, Jun 12, 2023 at 12:03=E2=80=AFPM Dan Williams 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. Now multiple 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? > confidential computing vendors trying to develop similar flows with > differentiated formats where that differentiation need not leak over the > ABI boundary. 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. 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. 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. > > 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", "") > > 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 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 (or "upstream community") did not want to implement/accept 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. 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. > > At this point I am just looking for confirmation that the "every vendor > invent a new character device + ioctl" does not scale and a deeper > conversation is needed. Keys is a plausible solution to that ABI > proliferation problem.