public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* KVM: x86: relax MSR_KVM_SYSTEM_TIME alignment check
@ 2013-03-22 19:14 Marcelo Tosatti
  2013-03-22 19:21 ` Gleb Natapov
  0 siblings, 1 reply; 8+ messages in thread
From: Marcelo Tosatti @ 2013-03-22 19:14 UTC (permalink / raw)
  To: Andy Honig, Gleb Natapov; +Cc: kvm


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 <mtosatti@redhat.com>

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,

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-04-11 16:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-22 19:14 KVM: x86: relax MSR_KVM_SYSTEM_TIME alignment check Marcelo Tosatti
2013-03-22 19:21 ` Gleb Natapov
2013-03-22 19:47   ` Marcelo Tosatti
2013-03-22 21:19     ` KVM: x86: drop alignment checks from KVM_MSR_SYSTEM_TIME address Marcelo Tosatti
2013-03-22 21:57       ` Gleb Natapov
2013-03-23  0:17         ` Andrew Honig
2013-03-23 14:12           ` Gleb Natapov
2013-04-11 16:05             ` Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox