check steal time address when enable steal time, disable steal time if guest gives a wrong address, to avoid unnecessary write/read invalid memory Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx> --- arch/x86/kvm/x86.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 2686f2e..8c7f4f4 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3440,6 +3440,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) if (data & KVM_STEAL_RESERVED_MASK) return 1; + if (!kvm_vcpu_gfn_to_memslot(vcpu, data >> PAGE_SHIFT)) + return 1; + vcpu->arch.st.msr_val = data; if (!(data & KVM_MSR_ENABLED)) -- 1.7.1