Skip to contentSkip to conversation

KVM: nVMX: Disallow VM-entry in MOV-SS shadow

PATCH New Jim Mattson 1 participant 1 message Jul 17, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: nVMX: Disallow VM-entry in MOV-SS shadow

Immediately following MOV-to-SS/POP-to-SS, VM-entry is disallowed. This check comes after the check for a valid VMCS. When this check fails, the instruction pointer should fall through to the next instruction, the ALU flags should be set to indicate VMfailValid, and the VM-instruction error should be set to 26 ("VM entry with events blocked by MOV SS").

---
 arch/x86/kvm/vmx.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/x86/kvm/vmx.c +7 -0
index 84e62acf2dd8..256d6d06f74d 100644
@@ -10488,6 +10488,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
 {
 	struct vmcs12 *vmcs12;
 	struct vcpu_vmx *vmx = to_vmx(vcpu);
+	u32 interrupt_shadow = vmx_get_interrupt_shadow(vcpu);
 	u32 exit_qual;
 	int ret;
 
@@ -10512,6 +10513,12 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
 	 * for misconfigurations which will anyway be caught by the processor
 	 * when using the merged vmcs02.
 	 */
+	if (interrupt_shadow & KVM_X86_SHADOW_INT_MOV_SS) {
+		nested_vmx_failValid(vcpu,
+				     VMXERR_ENTRY_EVENTS_BLOCKED_BY_MOV_SS);
+		goto out;
+	}
+
 	if (vmcs12->launch_state == launch) {
 		nested_vmx_failValid(vcpu,
 			launch ? VMXERR_VMLAUNCH_NONCLEAR_VMCS
Signature · 1 line
2.13.2.932.g7449e964c-goog