Patch "KVM: VMX: fix SMEP and SMAP without EPT" has been added to the 4.3-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
KVM: VMX: fix SMEP and SMAP without EPT
to the 4.3-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
kvm-vmx-fix-smep-and-smap-without-ept.patch
and it can be found in the queue-4.3 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
656ec4a4928a3db7d16e5cb9bce351a478cfd3d5Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= <[email protected]>
Date: Mon, 2 Nov 2015 22:20:00 +0100
Subject: KVM: VMX: fix SMEP and SMAP without EPT
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= <[email protected]>
commit 656ec4a4928a3db7d16e5cb9bce351a478cfd3d5 upstream.
The comment in code had it mostly right, but we enable paging for emulated real mode regardless of EPT.
Without EPT (which implies emulated real mode), secondary VCPUs won't start unless we disable SM[AE]P when the guest doesn't use paging.
--- arch/x86/kvm/vmx.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
arch/x86/kvm/vmx.c +10 -9
@@ -3644,20 +3644,21 @@ static int vmx_set_cr4(struct kvm_vcpu *if (!is_paging (vcpu)) { hw_cr4 &= ~X86_CR4_PAE ; hw_cr4 |=X86_CR4_PSE ; -/* -* SMEP/SMAP is disabled if CPU is in non-paging mode -* in hardware. However KVM always uses paging mode to -* emulate guest non-paging mode with TDP. -* To emulate this behavior, SMEP/SMAP needs to be -* manually disabled when guest switches to non-paging -* mode. -*/ - hw_cr4 &= ~(X86_CR4_SMEP |X86_CR4_SMAP ); }else if (!(cr4 &X86_CR4_PAE )) { hw_cr4 &= ~X86_CR4_PAE ; } } +if (!enable_unrestricted_guest && !is_paging (vcpu)) +/* +* SMEP/SMAP is disabled if CPU is in non-paging mode in +* hardware. However KVM always uses paging mode without +* unrestricted guest. +* To emulate this behavior, SMEP/SMAP needs to be manually +* disabled when guest switches to non-paging mode. +*/ + hw_cr4 &= ~(X86_CR4_SMEP |X86_CR4_SMAP ); +vmcs_writel (CR4_READ_SHADOW , cr4);vmcs_writel (GUEST_CR4 , hw_cr4);return 0 ;
Patches currently in stable-queue which might be from [email protected] are
queue-4.3/kvm-vmx-fix-smep-and-smap-without-ept.patch queue-4.3/kvm-x86-expose-msr_tsc_aux-to-userspace.patch