diff options
author | Andy Honig <ahonig@google.com> | 2014-08-27 11:16:44 -0700 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-10-24 13:21:08 +0200 |
commit | 8b3c3104c3f4f706e99365c3e0d2aa61b95f969f (patch) | |
tree | ccb686a3c75ce3b921a77038365752130b6ff589 /arch/x86/kvm/vmx.c | |
parent | 854e8bb1aa06c578c2c9145fa6bfe3680ef63b23 (diff) | |
download | lwn-8b3c3104c3f4f706e99365c3e0d2aa61b95f969f.tar.gz lwn-8b3c3104c3f4f706e99365c3e0d2aa61b95f969f.zip |
KVM: x86: Prevent host from panicking on shared MSR writes.
The previous patch blocked invalid writes directly when the MSR
is written. As a precaution, prevent future similar mistakes by
gracefulling handle GPs caused by writes to shared MSRs.
Cc: stable@vger.kernel.org
Signed-off-by: Andrew Honig <ahonig@google.com>
[Remove parts obsoleted by Nadav's patch. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 148020a7dd98..7e2c098b59c9 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2659,12 +2659,15 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) default: msr = find_msr_entry(vmx, msr_index); if (msr) { + u64 old_msr_data = msr->data; msr->data = data; if (msr - vmx->guest_msrs < vmx->save_nmsrs) { preempt_disable(); - kvm_set_shared_msr(msr->index, msr->data, - msr->mask); + ret = kvm_set_shared_msr(msr->index, msr->data, + msr->mask); preempt_enable(); + if (ret) + msr->data = old_msr_data; } break; } |