Skip to content

Commit 2a4763a

Browse files
Gleb Natapovkamalmostafa
authored andcommitted
KVM: VMX: fix halt emulation while emulating invalid guest sate
commit 8d76c49 upstream. The invalid guest state emulation loop does not check halt_request which causes 100% cpu loop while guest is in halt and in invalid state, but more serious issue is that this leaves halt_request set, so random instruction emulated by vm86 #GP exit can be interpreted as halt which causes guest hang. Fix both problems by handling halt_request in emulation loop. Reported-by: Tomas Papan <[email protected]> Tested-by: Tomas Papan <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Signed-off-by: Gleb Natapov <[email protected]> Signed-off-by: Kamal Mostafa <[email protected]>
1 parent 135be9f commit 2a4763a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

arch/x86/kvm/vmx.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5059,6 +5059,12 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)
50595059
return 0;
50605060
}
50615061

5062+
if (vcpu->arch.halt_request) {
5063+
vcpu->arch.halt_request = 0;
5064+
ret = kvm_emulate_halt(vcpu);
5065+
goto out;
5066+
}
5067+
50625068
if (signal_pending(current))
50635069
goto out;
50645070
if (need_resched())

0 commit comments

Comments
 (0)