From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: KVM: x86: relax MSR_KVM_SYSTEM_TIME alignment check Date: Fri, 22 Mar 2013 16:14:07 -0300 Message-ID: <20130322191407.GA23681@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm To: Andy Honig , Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:53982 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754874Ab3CVTO2 (ORCPT ); Fri, 22 Mar 2013 15:14:28 -0400 Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: RHEL5 i386 guests register non 32-byte aligned addresses: kvm-clock: cpu 1, msr 0:3018aa5, secondary cpu clock kvm-clock: cpu 2, msr 0:301f8e9, secondary cpu clock kvm-clock: cpu 3, msr 0:302672d, secondary cpu clock Check for an address+len that would cross page boundary instead. Signed-off-by: Marcelo Tosatti diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f19ac0a..ad36d386 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1952,8 +1952,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) gpa_offset = data & ~(PAGE_MASK | 1); - /* Check that the address is 32-byte aligned. */ - if (gpa_offset & (sizeof(struct pvclock_vcpu_time_info) - 1)) + /* Check that address+len does not cross page boundary */ + if ((gpa_offset + sizeof(struct pvclock_vcpu_time_info) - 1) + & PAGE_MASK) break; if (kvm_gfn_to_hva_cache_init(vcpu->kvm,