From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA9F672 for ; Tue, 20 Jul 2021 22:01:34 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10051"; a="211393011" X-IronPort-AV: E=Sophos;i="5.84,256,1620716400"; d="scan'208";a="211393011" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2021 15:01:19 -0700 X-IronPort-AV: E=Sophos;i="5.84,256,1620716400"; d="scan'208";a="415387981" Received: from tassilo.jf.intel.com ([10.54.74.11]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2021 15:01:19 -0700 Date: Tue, 20 Jul 2021 15:01:13 -0700 From: Andi Kleen To: Erdem Aktas Cc: Andy Lutomirski , Joerg Roedel , David Rientjes , Borislav Petkov , Sean Christopherson , Andrew Morton , Vlastimil Babka , "Kirill A. Shutemov" , Brijesh Singh , Tom Lendacky , Jon Grimm , Thomas Gleixner , "Peter Zijlstra (Intel)" , Paolo Bonzini , Ingo Molnar , "Kaplan, David" , Varad Gautam , Dario Faggioli , the arch/x86 maintainers , linux-mm@kvack.org, linux-coco@lists.linux.dev Subject: Re: Runtime Memory Validation in Intel-TDX and AMD-SNP Message-ID: <20210720220113.GA535804@tassilo.jf.intel.com> References: Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Jul 20, 2021 at 12:54:16PM -0700, Erdem Aktas wrote: > Now let's say the kernel wants to access a page for the first time, or > after a kexec it wants to make sure all the pages are private. it > needs to call tdx_hcall_gpa_intent or tdg_accept_page individually. > If the page is already accepted, tdg_accept_page does not return any > error in the current implementation in v3. Depending on how this page > is being used, it's content is now "not zeroed" as opposed to what it > is being expected. Converting this to an attack is not trivial but > possible. You mean when the TDVF is changed? In this case the unaccepted memory will be a different memory type, so not lazy accept enabled kernels wouldn't use it. > > I did not see any #VE implementation to handle SEPT violations when a > page is in PENDING state. I am assuming that this needs to be > supported at some point (If not then we need to discuss the use cases > for such support). We actually plan to disable those #VEs, to avoid any problems with the system call gap. Instead the plan is that the kernel will know in advance what memory has been accepted or not, and accept it before touching. -Andi