Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7708258rwl; Thu, 23 Mar 2023 07:48:37 -0700 (PDT) Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=BbR54qJc X-Google-Smtp-Source: AK7set86ITdHb31A3xP/0ybg1V9An1t4tEEXR/4zasRFiPYjZIjZpxTTla86KULwXcZ32z1vbvd5 X-Received: by 2002:a17:90b:38cf:b0:23d:2027:c355 with SMTP id nn15-20020a17090b38cf00b0023d2027c355mr8154161pjb.10.1679582917658; Thu, 23 Mar 2023 07:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679582917; cv=none; d=google.com; s=arc-20160816; b=Qjoo1jwBF++MdMKphiWSRx+KyAYrkSVRF3eXpRQ2i9gX1ThjMl+zuziiGlS6bdlXYO uj15Ev7vVkxWlhu1I1hi0UEhuJQTBRyVAb+hl6NysrLqNbDoee7CUzDulwToLz+LdbOI u4hq+OqPDMIBUpEYM/4iIm1uxJbLQXj3P4Ba8Vuf+kfs/bOt93ngftQ79xcdrbHTl8VE I58vLGZ6wOBM6grId4+GcnHKtKCoyIJq6PWpC04lee07UDFrca4YKu4fLj6NlfIaw6x+ qQ7L7bjmlBOKocNE5f93l1xdGbdTOSnTeoluqAFsNmF0vmklDYSpWY3g4j5WlE1Gv5HI SncA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-filter; bh=M39nxlqXkoyUrlklh46rqj7I8AqHEUzbGTrOkDu6MUk=; b=VtfuM/lJoMufyMGa8GDhrS0Ct78vY9HJABwPUpiCr4bYSGGn9m3ds+f/74ZjkyztMq g5/U6ILmjKD60Pof7uwmg0auAZKv6ZpPprGKpfVfxK+p/ALkt3YZLAyDHQzq3wyYNEi+ YGFPB9iRirAh0UX8DY981pfPPlq/WnBeVwdqWbtT3gajKzqAaHoeJyj6/MvXT60qGfPY iAY63GAEyw9wmIMSq6wsRBlkIQlpHCuFVToKZDOtDK1dWHDcMM4zKNP5lGFq6MMtphTa LO95PWk+lnLvfJgTIi1JkVT5yE0MN7HaQ5byEDE4296SF4M1nxC9AjTMymyqj/yQsal6 c6EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=BbR54qJc; 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=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b18-20020a17090ae39200b0023d2b3ac7a2si1896327pjz.60.2023.03.23.07.48.25; Thu, 23 Mar 2023 07:48:37 -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=@linux.microsoft.com header.s=default header.b=BbR54qJc; 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=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231742AbjCWOqj (ORCPT + 99 others); Thu, 23 Mar 2023 10:46:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231646AbjCWOqe (ORCPT ); Thu, 23 Mar 2023 10:46:34 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6C23E24730; Thu, 23 Mar 2023 07:46:26 -0700 (PDT) Received: from [192.168.2.39] (77-166-152-30.fixed.kpn.net [77.166.152.30]) by linux.microsoft.com (Postfix) with ESMTPSA id B267820FC068; Thu, 23 Mar 2023 07:46:23 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B267820FC068 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1679582785; bh=M39nxlqXkoyUrlklh46rqj7I8AqHEUzbGTrOkDu6MUk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=BbR54qJcpPIqdDFc8GoIEc90FLeMzU9Oh0pqv/i4xyh8yJ6QkWZTuEy147ludwpQ7 5g5QRFSpSBDtGNwdl4MSky+N1wnYeFFQEgyvRll8xjLawuGFP8qUM7+EagaX7rHOet keqnY1InTIWg+M2CrfepNr84M8wMxaKsWROyJ/C0= Message-ID: Date: Thu, 23 Mar 2023 15:46:22 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v3 0/8] Support ACPI PSP on Hyper-V To: Borislav Petkov Cc: linux-kernel@vger.kernel.org, Brijesh Singh , Tom Lendacky , "Kalra, Ashish" , linux-crypto@vger.kernel.org, "Rafael J. Wysocki" , Len Brown , linux-acpi@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Dave Hansen , x86@kernel.org References: <20230320191956.1354602-1-jpiotrowski@linux.microsoft.com> <20230322154655.GDZBsi75f6LnQStxSp@fat_crate.local> <1d25221c-eaab-0f97-83aa-8b4fbe3a53ed@linux.microsoft.com> <20230322181541.GEZBtFzRAMcH9BAzUe@fat_crate.local> Content-Language: en-US From: Jeremi Piotrowski In-Reply-To: <20230322181541.GEZBtFzRAMcH9BAzUe@fat_crate.local> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-17.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On 3/22/2023 7:15 PM, Borislav Petkov wrote: > On Wed, Mar 22, 2023 at 06:33:37PM +0100, Jeremi Piotrowski wrote: >> What this does is it allows a normal (non-SNP) VM to host confidential (SNP) >> VMs. I say "normal" but not every VM is going to be able to do this, it needs > > If you say "non-SNP" VM then this sounds like purely for development. > Because I cannot see how you're going to give the confidentiality > guarantee to the SNP guests if the lower level is unencrypted, non-SNP > and so on... Not at all. Just to be clear: this lights up all the same bits of SNP as it does on bare-metal, none of it is emulated away. On bare-metal the hypervisor underneath the SNP guest is unencrypted as well. Here the stack is: L0 (Hyper-V), L1 (KVM) and L2 (SNP guest). Starting an SNP guest is the same and involves sending commands to the PSP: * SNP_GCTX_CREATE * SNP_LAUNCH_START * SNP_LAUNCH_UPDATE * SNP_LAUNCH_FINISH Pages need to be assigned to a specific L2 SNP guest in the system-wide "reverse map table", at which point neither L0 nor L1 hypervisor can touch them. Every L2 SNP guests memory is encrypted with a different key, and the SNP guest can fetch a hardware signed attestation report from the PSP that includes a hash of all the pages that were loaded (and encrypted) into the VM address space at the time the VM was launched. The communication channel between L2 guest and PSP is secured using keys that the PSP injects into the SNP guest's address space at launch time. Honestly, I find it pretty cool that you can stuff a whole extra hypervisor underneath the SNP guest, and the hardware will still ensure and attest to the fact that neither hypervisor is able to compromise the integrity and confidentiality of the VM enclave. And you can verify this claim independently. > >> to be running on AMD hardware and configured to have access to >> VirtualizationExtensions, a "HardwareIsolation" capability, and given a number >> of "hardware isolated guests" that it is allowed to spawn. In practice this >> will result in the VM seeing a PSP device, SEV-SNP related CPUID >> leafs, and have access to additional memory management instructions >> (rmpadjust/psmash). This allows the rest of the of KVM-SNP support to >> work. > > So why don't you emulate the PSP in KVM instead of doing some BIOS hack? > And multiplex the access to it between all the parties needing it? > Not sure I follow you here. The quoted paragraph talks about what the L1 VM (KVM) sees. The L1 VM needs to issue PSP commands to bring up an L2 SNP guest, and later the L1 VM relays SNP guest commands to the PSP. The PSP commands are multiplexed to the physical PSP by the L0 hypervisor (Hyper-V). So Hyper-V exposes a PSP to the L1 VM because it is needed and it is compatible with the existing Linux driver that handles the PSP. The way it is exposed (ACPI table) follows how it was specified by AMD.