From patchwork Fri Mar 22 19:14:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 2322271 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 8ABFC3FD8C for ; Fri, 22 Mar 2013 19:14:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755049Ab3CVTO3 (ORCPT ); Fri, 22 Mar 2013 15:14:29 -0400 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 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2MJERHY005229 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 22 Mar 2013 15:14:27 -0400 Received: from amt.cnet (vpn1-6-55.gru2.redhat.com [10.97.6.55]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r2MJEQAc032346; Fri, 22 Mar 2013 15:14:27 -0400 Received: from amt.cnet (localhost [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 4D705104065; Fri, 22 Mar 2013 16:14:08 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.6/8.14.6/Submit) id r2MJE7xU027748; Fri, 22 Mar 2013 16:14:07 -0300 Date: Fri, 22 Mar 2013 16:14:07 -0300 From: Marcelo Tosatti To: Andy Honig , Gleb Natapov Cc: kvm Subject: KVM: x86: relax MSR_KVM_SYSTEM_TIME alignment check Message-ID: <20130322191407.GA23681@amt.cnet> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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,