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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F9A6C433F5 for ; Thu, 3 Feb 2022 18:41:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353541AbiBCSlI (ORCPT ); Thu, 3 Feb 2022 13:41:08 -0500 Received: from mga12.intel.com ([192.55.52.136]:60318 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236478AbiBCSlE (ORCPT ); Thu, 3 Feb 2022 13:41:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643913664; x=1675449664; h=message-id:date:mime-version:to:cc:references:from: subject:in-reply-to:content-transfer-encoding; bh=j1rUkWkZiHJ+AeL3YGAaC3KE5WNVPE8P8N/y8SgMX4c=; b=lhid75iIwAWl1IOkhwnYlt3c4ZwNB825rjcdu4JebT2PO2jZDMuqB5hH x4wc2xHQwbWl1uHxd9AHIBF5cTMskEh+TGRg9uO4o0hvJbEvX+74hp2o6 F51cp+VEN0XHIo90ZY0+znDUQd3vkHRTvvUELvkMCGZBWC5Wc8Xiase7C MJi04uoNK5J91kqtosJs73dMgcw1z8PvG4ZVFM1fB+mho6L/EUNm4U0tp bI9EBL3ouFvJItW+X5sGO62f3/uJW0hZoLXvQX3ncF82BzHR5NHq5tFc7 ZpiBAdu3qhDj3vSgLq6AJyUggYYDkoCJmB2w6/LJQVgidWrC9OZi6JNiX A==; X-IronPort-AV: E=McAfee;i="6200,9189,10247"; a="228189381" X-IronPort-AV: E=Sophos;i="5.88,340,1635231600"; d="scan'208";a="228189381" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2022 10:40:53 -0800 X-IronPort-AV: E=Sophos;i="5.88,340,1635231600"; d="scan'208";a="535299218" Received: from oshoron-mobl.amr.corp.intel.com (HELO [10.209.125.125]) ([10.209.125.125]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2022 10:40:52 -0800 Message-ID: <6c55ac92-0470-07ba-77c0-4701c4ea7ce3@intel.com> Date: Thu, 3 Feb 2022 10:40:50 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Content-Language: en-US To: Fares Mehanna , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Jarkko Sakkinen , "Shutemov, Kirill" , "Williams, Dan J" Cc: x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org References: <20220203181432.34911-1-faresx@amazon.de> From: Dave Hansen Subject: Re: [PATCH] KVM: VMX: pass TME information to guests In-Reply-To: <20220203181432.34911-1-faresx@amazon.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/3/22 10:14, Fares Mehanna wrote: > This will guarantee that hardware supports TME, MSRs are locked, so host can't > change them and exclusion range is disabled, so TME rules apply on all host > memory. But, what's the point? Guests can't trust this information. The host can lie all it wants about it. Also, your assumptions about TME rules applying to *all* host memory are a bit aggressive. Even if the guest knew for sure that it was reading an MSR directly, it doesn't mean that any guest memory is actually TME-protected. The memory could be from a non-TME range like persistent memory. There are some weasel words in the spec about this: > Upon activation, all memory (except in TME Exclusion range) attached > to CPU/SoC is encrypted using AES-XTS 128 bit ephemeral key (platform > key) that is generated by the CPU on every boot. The important part here is "attached to the CPU/SoC". I guess they don't count persistent memory as "attached". This also obviously would not apply to non-CPU-attached memory that was attached by something like CXL[1]. The extra fun part of all this is that the architecture doesn't provide a way to tell if the memory is "attached to the CPU/SoC". That makes it impossible to get any guarantees out of all this. In other words, you can't trust the exclusion range in the MSR to be the *ONLY* non-TME-protected area. 1. https://www.computeexpresslink.org/