Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: x86: fix uninitialized variable use on KVM_REQ_TRIPLE_FAULT

If a triple fault was fixed by kvm_x86_ops.nested_ops->triple_fault (by
turning it into a vmexit), there is no need to leave vcpu_enter_guest().
Any vcpu->requests will be caught later before the actual vmentry,
and in fact vcpu_enter_guest() was not initializing the "r" variable.
Depending on the compiler's whims, this could cause the
x86_64/triple_fault_event_test test to fail.

Cc: Maxim Levitsky <mlevitsk@redhat.com>
Fixes: 92e7d5c83aff ("KVM: x86: allow L1 to not intercept triple fault")
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

+1 -1
+1 -1
arch/x86/kvm/x86.c
··· 10280 10280 vcpu->run->exit_reason = KVM_EXIT_SHUTDOWN; 10281 10281 vcpu->mmio_needed = 0; 10282 10282 r = 0; 10283 + goto out; 10283 10284 } 10284 - goto out; 10285 10285 } 10286 10286 if (kvm_check_request(KVM_REQ_APF_HALT, vcpu)) { 10287 10287 /* Page is swapped out. Do synthetic halt */