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 X-Spam-Level: X-Spam-Status: No, score=-6.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DF0CC433EF for ; Thu, 2 Sep 2021 20:42:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7C82B61054 for ; Thu, 2 Sep 2021 20:42:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344607AbhIBUn4 (ORCPT ); Thu, 2 Sep 2021 16:43:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:59298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232045AbhIBUnz (ORCPT ); Thu, 2 Sep 2021 16:43:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 31A8060FDA; Thu, 2 Sep 2021 20:42:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630615376; bh=rWIymJXj+z/ROnyg3o5j/Hn6mBCszau7W/Lim8edb4A=; h=In-Reply-To:References:Date:From:To:Cc:Subject:From; b=lZl9S5JcZecn4dzUrXeaGD0pBee4WU3gjZKJ9NXRJHcTEniagn6SEmZxstuB5eUYl 5wAz9oPTsLg9hfa9mRCybTd4mx5lnFrV3u67dSjhAgAbvUuujLItVNR0VJNj2DAfCf khdOwzp21TM1TaI0k+8W5Eowdi9bbXTMG86RxVufzK/X4hA3RDIoNDg1/ykUBCnddm q02AOxZoXCPnsuQggYahQoRN590utXvDFJrPskDSzB4+9NyjVoPBqP3Ofq/1hQbM7k HSH3JJ9S2fEEBd9o5AaDjfmJRwMN6phbq8X+qsPG8NsgPmKPMMMnyEePgeAOwcLNQo p6biWSMye4b7A== Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 4B85727C0054; Thu, 2 Sep 2021 16:42:53 -0400 (EDT) Received: from imap2 ([10.202.2.52]) by compute6.internal (MEProxy); Thu, 02 Sep 2021 16:42:53 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvhedgudehvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderreejnecuhfhrohhmpedftehn ugihucfnuhhtohhmihhrshhkihdfuceolhhuthhosehkvghrnhgvlhdrohhrgheqnecugg ftrfgrthhtvghrnhepgeejgffhtdelvdefgeefleevtdfgveekuefgkeffvdevfeefteei heeuteevkeefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homheprghnugihodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdduudeiudek heeifedvqddvieefudeiiedtkedqlhhuthhopeepkhgvrhhnvghlrdhorhhgsehlihhnuh igrdhluhhtohdruhhs X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id E78B2A002E4; Thu, 2 Sep 2021 16:42:49 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-1126-g6962059b07-fm-20210901.001-g6962059b Mime-Version: 1.0 Message-Id: In-Reply-To: References: <20210824005248.200037-1-seanjc@google.com> <307d385a-a263-276f-28eb-4bc8dd287e32@redhat.com> <20210827023150.jotwvom7mlsawjh4@linux.intel.com> <8f3630ff-bd6d-4d57-8c67-6637ea2c9560@www.fastmail.com> <20210901102437.g5wrgezmrjqn3mvy@linux.intel.com> Date: Thu, 02 Sep 2021 13:42:28 -0700 From: "Andy Lutomirski" To: "Dave Hansen" , "Sean Christopherson" Cc: "Joerg Roedel" , "Yu Zhang" , "David Hildenbrand" , "Paolo Bonzini" , "Vitaly Kuznetsov" , "Wanpeng Li" , "Jim Mattson" , "Joerg Roedel" , "kvm list" , "Linux Kernel Mailing List" , "Borislav Petkov" , "Andrew Morton" , "Andi Kleen" , "David Rientjes" , "Vlastimil Babka" , "Tom Lendacky" , "Thomas Gleixner" , "Peter Zijlstra (Intel)" , "Ingo Molnar" , "Varad Gautam" , "Dario Faggioli" , "the arch/x86 maintainers" , linux-mm@kvack.org, linux-coco@lists.linux.dev, "Kirill A. Shutemov" , "Kirill A . Shutemov" , "Sathyanarayanan Kuppuswamy" Subject: =?UTF-8?Q?Re:_[RFC]_KVM:_mm:_fd-based_approach_for_supporting_KVM_guest_?= =?UTF-8?Q?private_memory?= Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 2, 2021, at 12:07 PM, Dave Hansen wrote: > On 9/2/21 11:57 AM, Sean Christopherson wrote: > > On Thu, Sep 02, 2021, Andy Lutomirski wrote: > >> On 9/2/21 2:27 AM, Joerg Roedel wrote: > >>> On Wed, Sep 01, 2021 at 09:07:59AM -0700, Andy Lutomirski wrote: > >>>> In principle, you could actually initialize a TDX guest with all of its > >>>> memory shared and all of it mapped in the host IOMMU. > >>> Not sure how this works in TDX, but in SEV code fetches are always > >>> treated as encrypted. So this approach would not work with SEV, not to > >>> speak about attestation, which will not work with this approach either > >>> :) > >>> > >> Oof. > > TDX is kinda similar. _All_ accesses are private if paging is disabled because > > the shared bit is either bit 48 or bit 51 in the GPA, i.e. can't be reached if > > paging is disabled. The vCPU is hardcoded to start in unpaged protected mode, > > so at least some amount of guest memory needs to be private. > > That's a rule we should definitely add to our page table checker. Just > like how we can look for W+X, we should also look for Shared+X. > The only case I can thing of where the TDX vs SEV rule matters is for some mildly crazy user who wants to run user code out of an unencrypted DAX device (or virtio-fs, I guess). We can save that for another year :)