Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1327909rdb; Sun, 8 Oct 2023 02:38:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEc6OnLU7RaNtEdAD7GLASpwZB6Xi25rsrWu5+DZmJIFxrZAbkdyDjhJDz5fJ6mNKohg/9o X-Received: by 2002:a05:6e02:184f:b0:349:3020:d103 with SMTP id b15-20020a056e02184f00b003493020d103mr15718777ilv.25.1696757887748; Sun, 08 Oct 2023 02:38:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696757887; cv=none; d=google.com; s=arc-20160816; b=iHfITe/FGtJndM0t0AWNvqCIBN5V/q3EyK8YDOa9T721DpS/UQ3Ra5vsz1Esfs5ABI TDF72LCjGz9/nwJ13m2eLG8fIaeftrta7WmEJ8jmglxGlaf3r52cFp5AjrQbtnxObSsg L/IeCMScFbh+y/hbWyIg43Biv1AXSP+ccZx4MRkE+VeX5ObUfRcqX6YbcB77pZn7hjY1 g93Ed58vZr4EvyUA3BiwOrzB7fR8/wRvFCxni7PYA79oV0X9JQ7zyqHKrTZWHZAKRBse otYwF9ckMyDlfUKNUAjfwFYKH2MmhBeZqOWDhx6+hgg/FOZP/w+aSZ9mbJ2EK9bw7uCc Ntvw== 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 :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=+oWfAJh0doIJDpWew7zCR0StaQnZcOP2+wFpTLEX86o=; fh=gzROsbX+OZJsxfDJZxm1ZvYdyvsvy6tdvGQgtBo3ECI=; b=jKwpovDwx68u+3zG0xVFbLkH/a4IvKS5AFhRxd7/hXPbG2OC/SKs17Y24dx0IRAJIG 0OUGcRswV4wjOsCkV3lQYkn1N5UglaxX0i6XEl+GXtOfpY6vBeArF4/aG4iEzOt5IR7+ RTwVNqI10b1clxb2pDTHr9FxiwabXZFYIRoLV33J4pmzkY2NZJQIKTapg0KSdvlWQVO6 KE5tv7nIVAPeZnexYPiuOPFLq/ctU/JaTwSdTCER68/RdEO+VXMQOmVRMDEFuysECcO9 ezivbw/Ncd8//8+FO/UmFBdxIVvOvqHfgihnhfql4tqMvmsvomMR16o0Aa3d9rAA8fzP Gg0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Hul6q5fI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id s9-20020a170903200900b001bdc78deb5csi6952602pla.398.2023.10.08.02.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Oct 2023 02:38:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Hul6q5fI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 356A0804024A; Sun, 8 Oct 2023 02:38:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344567AbjJHJhu (ORCPT + 99 others); Sun, 8 Oct 2023 05:37:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230441AbjJHJht (ORCPT ); Sun, 8 Oct 2023 05:37:49 -0400 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21144B6; Sun, 8 Oct 2023 02:37:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696757867; x=1728293867; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=pZl858y3jcWEECXn8DCK3d9ymq7qvurpMSIhAHEG+Ws=; b=Hul6q5fIpFVoCdtSOGj6LhsGsY027gVvz5kgWWDI1z45uRBaRhw6aAGa Lr9EADwAFweZfvqIt91+7NvhJFGo8a2fqRIdMn0yB8MXZ31NOQejg/nKQ pG8xqlSIsvwR168xEPJM8U3xwxhwWv7hfUSZ/Gvih7paL/9iaYDmmahti Ua2qDLLZl+upToNWKzwKuv4Q1TScfCqRK8Q/3Pqi43oRiIea7p5b/3zIh Dn8vPejBuoLW5MzjSR5lawsGky6ZInQOWMn5SXOzNT7R1V1QNOv7Lb7Ex oZ4USezCUx2uX0ieBHU4UG9P/9WjFCRiG95gSTY6Wjojrk9n1OX5F3Far w==; X-IronPort-AV: E=McAfee;i="6600,9927,10856"; a="2591576" X-IronPort-AV: E=Sophos;i="6.03,207,1694761200"; d="scan'208";a="2591576" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2023 02:37:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10856"; a="823023975" X-IronPort-AV: E=Sophos;i="6.03,207,1694761200"; d="scan'208";a="823023975" Received: from binbinwu-mobl.ccr.corp.intel.com (HELO [10.93.2.44]) ([10.93.2.44]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2023 02:37:44 -0700 Message-ID: <46b73aa3-4776-8d95-b3f4-c2ddf4f0696c@linux.intel.com> Date: Sun, 8 Oct 2023 17:37:42 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v11 00/16] LAM and LASS KVM Enabling To: seanjc@google.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, pbonzini@redhat.com, chao.gao@intel.com, kai.huang@intel.com, David.Laight@ACULAB.COM, robert.hu@linux.intel.com, guang.zeng@intel.com References: <20230913124227.12574-1-binbin.wu@linux.intel.com> From: Binbin Wu In-Reply-To: <20230913124227.12574-1-binbin.wu@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=1.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sun, 08 Oct 2023 02:38:04 -0700 (PDT) Hi Sean, Does this version of LAM patch set have the chance to be pulled for 6.7? On 9/13/2023 8:42 PM, Binbin Wu wrote: > This patch series includes KVM enabling patches for Linear-address masking > (LAM) v11 and Linear Address Space Separation (LASS) v3 since the two features > have overlapping prep work and concepts. Sent as a single series to reduce the > probability of conflicts. > > The patch series is organized as follows: > - Patch 1-4: Common prep work for both LAM and LASS. > - Patch 5-13: LAM part. > - Patch 14-16: LASS part. > > Dependency: > - LAM has no other dependency. > - LASS patches depends on LASS kernel enabling patches, which are not merged yet. > https://lore.kernel.org/all/20230609183632.48706-1-alexander.shishkin@linux.intel.com/ > > > ==== LAM v11 ==== > > Linear-address masking (LAM) [1], modifies the checking that is applied to > *64-bit* linear addresses, allowing software to use of the untranslated > address bits for metadata and masks the metadata bits before using them as > linear addresses to access memory. > > When the feature is virtualized and exposed to guest, it can be used for > efficient address sanitizers (ASAN) implementation and for optimizations in > JITs and virtual machines. > > The patch series brings LAM virtualization support in KVM. > > Please review and consider applying. > > LAM QEMU patch: > https://lists.gnu.org/archive/html/qemu-devel/2023-07/msg04160.html > > LAM kvm-unit-tests patch: > https://lore.kernel.org/kvm/20230530024356.24870-1-binbin.wu@linux.intel.com/ > > --- Test --- > 1. Add test cases in kvm-unit-test for LAM [2], including LAM_SUP and LAM_{U57,U48}. > For supervisor pointers, the test covers CR4 LAM_SUP bits toggle, Memory/MMIO > access with tagged pointer, and some special instructions (INVLPG, INVPCID, > INVVPID), INVVPID cases also used to cover VMX instruction VMExit path. > For user pointers, the test covers CR3 LAM bits toggle, Memory/MMIO access with > tagged pointer. > MMIO cases are used to trigger instruction emulation path. > Run the unit test with both LAM feature on/off (i.e. including negative cases). > Run the unit test in L1 guest with both LAM feature on/off. > 2. Run Kernel LAM kselftests in guest, with both EPT=Y/N. > 3. Launch a nested guest and run tests listed in 1 & 2. > > All tests have passed on real machine supporting LAM. > > [1] Intel ISE https://cdrdv2.intel.com/v1/dl/getContent/671368 > Chapter Linear Address Masking (LAM) > [2] https://lore.kernel.org/kvm/20230530024356.24870-1-binbin.wu@linux.intel.com/ > > ---------- > Changelog > > v11: > - A separate patch to drop non-PA bits when getting GFN for guest's PGD [Sean] > - Add a patch to remove kvm_vcpu_is_illegal_gpa() [Isaku] > - Squash CR4 LAM bit handling with the address untag for supervisor pointers. [Sean] > - Squash CR3 LAM bits handling with the address untag for user pointers. [Sean] > - Adopt KVM-governed feature framework to track "LAM enabled" as a separate > optimization patch, and add the reason in patch change log. [Sean, Kai] > - Some comment modifications/additions according to reviews [Sean] > > v10: > https://lore.kernel.org/kvm/20230719144131.29052-1-binbin.wu@linux.intel.com/ > > > ==== LASS v3 ==== > > Linear Address Space Separation (LASS)[1] is a new mechanism that > enforces the same mode-based protections as paging, i.e. SMAP/SMEP > but without traversing the paging structures. Because the protections > enforced by LASS are applied before paging, "probes" by malicious > software will provide no paging-based timing information. > > This patch series provide a LASS KVM solution and depends on kernel > enabling that can be found at [2]. > > --- Test --- > 1. Test the basic function of LASS virtualization including LASS > enumeration and enabling in guest and nested environment. > 2. Run selftest with following cases: > - data access to user address space in supervisor mode > - data access to supervisor address space in user mode > - data access to linear address across space boundary > - Using KVM FEP mechanism to run test cases above > - VMX instruction execution with VMCS structure in user > address space > - instruction fetch from user address space in supervisor mode > - instruction fetch from supervisor address space in user mode > > All tests have passed on real machine supporting LASS. > > [1] Intel ISE spec https://cdrdv2.intel.com/v1/dl/getContent/671368 > Chapter Linear Address Space Separation (LASS) > > [2] LASS kernel patch series > https://lore.kernel.org/all/20230609183632.48706-1-alexander.shishkin@linux.intel.com/ > > ---------- > Change log > > v3: > 1. Refine commit message [Sean/Chao Gao] > 2. Enhance the implementation of LASS violation check [Sean] > 3. Re-organize patch as Sean's suggestion [Sean] > > v2: > https://lore.kernel.org/all/20230719024558.8539-1-guang.zeng@intel.com/ > > > Binbin Wu (10): > KVM: x86: Consolidate flags for __linearize() > KVM: x86: Use a new flag for branch targets > KVM: x86: Add an emulation flag for implicit system access > KVM: x86: Add X86EMUL_F_INVLPG and pass it in em_invlpg() > KVM: x86/mmu: Drop non-PA bits when getting GFN for guest's PGD > KVM: x86: Add & use kvm_vcpu_is_legal_cr3() to check CR3's legality > KVM: x86: Remove kvm_vcpu_is_illegal_gpa() > KVM: x86: Introduce get_untagged_addr() in kvm_x86_ops and call it in > emulator > KVM: x86: Untag address for vmexit handlers when LAM applicable > KVM: x86: Use KVM-governed feature framework to track "LAM enabled" > > Robert Hoo (3): > KVM: x86: Virtualize LAM for supervisor pointer > KVM: x86: Virtualize LAM for user pointer > KVM: x86: Advertise and enable LAM (user and supervisor) > > Zeng Guang (3): > KVM: emulator: Add emulation of LASS violation checks on linear > address > KVM: VMX: Virtualize LASS > KVM: x86: Advertise LASS CPUID to user space > > arch/x86/include/asm/kvm-x86-ops.h | 4 +- > arch/x86/include/asm/kvm_host.h | 8 ++- > arch/x86/kvm/cpuid.c | 4 +- > arch/x86/kvm/cpuid.h | 13 ++-- > arch/x86/kvm/emulate.c | 39 +++++++---- > arch/x86/kvm/governed_features.h | 1 + > arch/x86/kvm/kvm_emulate.h | 13 ++++ > arch/x86/kvm/mmu.h | 8 +++ > arch/x86/kvm/mmu/mmu.c | 2 +- > arch/x86/kvm/mmu/mmu_internal.h | 1 + > arch/x86/kvm/mmu/paging_tmpl.h | 2 +- > arch/x86/kvm/svm/nested.c | 4 +- > arch/x86/kvm/vmx/nested.c | 14 ++-- > arch/x86/kvm/vmx/sgx.c | 4 +- > arch/x86/kvm/vmx/vmx.c | 106 ++++++++++++++++++++++++++++- > arch/x86/kvm/vmx/vmx.h | 5 ++ > arch/x86/kvm/x86.c | 28 +++++++- > arch/x86/kvm/x86.h | 4 ++ > 18 files changed, 226 insertions(+), 34 deletions(-) > > > base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d > prerequisite-patch-id: 51db36ad7156234d05f8c4004ec6a31ef609b81a