Skip to contentSkip to conversation

KVM: nVMX: Reset RFLAGS on VM-exit

PATCH Applied Jan Kiszka 3 participants 3 messages Mar 3, 2013 – Mar 6, 2013

Subsystems (3)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH v2 1/1 KVM: nVMX: Reset RFLAGS on VM-exit

From: Jan Kiszka <[email protected]>

Ouch, how could this work so well that far? We need to clear RFLAGS to the reset value as specified by the SDM. Particularly, IF must be off after VM-exit!

---

Changes in v2:
- use symbolic constant for rflags reset value

 arch/x86/kvm/vmx.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kvm/vmx.c +1 -0
index 486078d..eece4c8 100644
@@ -7454,6 +7454,7 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,
 
 	kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->host_rsp);
 	kvm_register_write(vcpu, VCPU_REGS_RIP, vmcs12->host_rip);
+	vmx_set_rflags(vcpu, X86_EFLAGS_BIT1);
 	/*
 	 * Note that calling vmx_set_cr0 is important, even if cr0 hasn't
 	 * actually changed, because it depends on the current state of
Signature · 1 line
1.7.3.4
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

Ouch, how could this work so well that far? We need to clear RFLAGS to the reset value as specified by the SDM. Particularly, IF must be off after VM-exit!

Quoted 22 lines

---

Changes in v2:
- use symbolic constant for rflags reset value

 arch/x86/kvm/vmx.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kvm/vmx.c +1 -0
index 486078d..eece4c8 100644
@@ -7454,6 +7454,7 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,
 
 	kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->host_rsp);
 	kvm_register_write(vcpu, VCPU_REGS_RIP, vmcs12->host_rip);
+	vmx_set_rflags(vcpu, X86_EFLAGS_BIT1);
 	/*
 	 * Note that calling vmx_set_cr0 is important, even if cr0 hasn't
 	 * actually changed, because it depends on the current state of
Signature · 1 line
1.7.3.4

--
Gleb.