Commit eff708bc authored by Avi Kivity's avatar Avi Kivity

KVM: VMX: Only reload guest msrs if they are already loaded

If we set an msr via an ioctl() instead of by handling a guest exit, we
have the host state loaded, so reloading the msrs would clobber host
state instead of guest state.

This fixes a host oops (and loss of a cpu) on a guest reboot.
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent 47ad8e68
...@@ -600,7 +600,8 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) ...@@ -600,7 +600,8 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
msr = find_msr_entry(vcpu, msr_index); msr = find_msr_entry(vcpu, msr_index);
if (msr) if (msr)
msr->data = data; msr->data = data;
load_msrs(vcpu->guest_msrs, NR_BAD_MSRS); if (vcpu->vmx_host_state.loaded)
load_msrs(vcpu->guest_msrs, NR_BAD_MSRS);
break; break;
#endif #endif
case MSR_IA32_SYSENTER_CS: case MSR_IA32_SYSENTER_CS:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment