lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190918061237.910306483@linuxfoundation.org>
Date:   Wed, 18 Sep 2019 08:19:38 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        stable@...r.kernel.org, Junaid Shahid <junaids@...gle.com>,
        Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>,
        Nadav HarEl <nyh@...ibm.com>,
        Jun Nakajima <jun.nakajima@...el.com>,
        Xinhao Xu <xinhao.xu@...el.com>,
        Yang Zhang <yang.z.zhang@...el.com>,
        Gleb Natapov <gleb@...hat.com>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Jim Mattson <jmattson@...gle.com>
Subject: [PATCH 5.2 80/85] kvm: nVMX: Remove unnecessary sync_roots from handle_invept

From: Jim Mattson <jmattson@...gle.com>

commit b119019847fbcac36ed1384f166c91f177d070e7 upstream.

When L0 is executing handle_invept(), the TDP MMU is active. Emulating
an L1 INVEPT does require synchronizing the appropriate shadow EPT
root(s), but a call to kvm_mmu_sync_roots in this context won't do
that. Similarly, the hardware TLB and paging-structure-cache entries
associated with the appropriate shadow EPT root(s) must be flushed,
but requesting a TLB_FLUSH from this context won't do that either.

How did this ever work? KVM always does a sync_roots and TLB flush (in
the correct context) when transitioning from L1 to L2. That isn't the
best choice for nested VM performance, but it effectively papers over
the mistakes here.

Remove the unnecessary operations and leave a comment to try to do
better in the future.

Reported-by: Junaid Shahid <junaids@...gle.com>
Fixes: bfd0a56b90005f ("nEPT: Nested INVEPT")
Cc: Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>
Cc: Nadav Har'El <nyh@...ibm.com>
Cc: Jun Nakajima <jun.nakajima@...el.com>
Cc: Xinhao Xu <xinhao.xu@...el.com>
Cc: Yang Zhang <yang.z.zhang@...el.com>
Cc: Gleb Natapov <gleb@...hat.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>
Reviewed-by Peter Shier <pshier@...gle.com>
Reviewed-by: Junaid Shahid <junaids@...gle.com>
Signed-off-by: Jim Mattson <jmattson@...gle.com>
Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>

---
 arch/x86/kvm/vmx/nested.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -4708,13 +4708,11 @@ static int handle_invept(struct kvm_vcpu
 
 	switch (type) {
 	case VMX_EPT_EXTENT_GLOBAL:
+	case VMX_EPT_EXTENT_CONTEXT:
 	/*
-	 * TODO: track mappings and invalidate
-	 * single context requests appropriately
+	 * TODO: Sync the necessary shadow EPT roots here, rather than
+	 * at the next emulated VM-entry.
 	 */
-	case VMX_EPT_EXTENT_CONTEXT:
-		kvm_mmu_sync_roots(vcpu);
-		kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
 		break;
 	default:
 		BUG_ON(1);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ