Message ID | 1636094263-13695-1-git-send-email-lirongqing@baidu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | KVM: x86: check steal time address when enable steal time | expand |
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))
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@baidu.com> --- arch/x86/kvm/x86.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)