mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Hollis Blanchard <hollisb@us.ibm.com>
Subject: [PATCH 09/44] KVM: ensure that memslot userspace addresses are page-aligned
Date: Tue,  9 Dec 2008 22:22:24 +0200	[thread overview]
Message-ID: <1228854179-23002-10-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1228854179-23002-1-git-send-email-avi@redhat.com>

From: Hollis Blanchard <hollisb@us.ibm.com>

Bad page translation and silent guest failure ensue if the userspace address is
not page-aligned.  I hit this problem using large (host) pages with qemu,
because qemu currently has a hardcoded 4096-byte alignment for guest memory
allocations.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
---
 virt/kvm/kvm_main.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index a65baa9..0a0a959 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -715,6 +715,8 @@ int __kvm_set_memory_region(struct kvm *kvm,
 		goto out;
 	if (mem->guest_phys_addr & (PAGE_SIZE - 1))
 		goto out;
+	if (mem->userspace_addr & (PAGE_SIZE - 1))
+		goto out;
 	if (mem->slot >= KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS)
 		goto out;
 	if (mem->guest_phys_addr + mem->memory_size < mem->guest_phys_addr)
-- 
1.6.0.3


  parent reply	other threads:[~2008-12-09 20:37 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-09 20:22 [PATCH 00/44] KVM Updates for 2.6.29 (part 2 of 3) Avi Kivity
2008-12-09 20:22 ` [PATCH 01/44] KVM: ppc: adjust vcpu types to support 64-bit cores Avi Kivity
2008-12-09 20:22 ` [PATCH 02/44] KVM: ppc: fix set regs to take care of msr change Avi Kivity
2008-12-09 20:22 ` [PATCH 03/44] KVM: ppc: optimize kvm stat handling Avi Kivity
2008-12-09 20:22 ` [PATCH 04/44] KVM: ppc: optimize find first bit Avi Kivity
2008-12-09 20:22 ` [PATCH 05/44] KVM: ppc: optimize irq delivery path Avi Kivity
2008-12-09 20:22 ` [PATCH 06/44] KVM: ppc: improve trap emulation Avi Kivity
2008-12-09 20:22 ` [PATCH 07/44] KVM: Fix cpuid leaf 0xb loop termination Avi Kivity
2008-12-09 20:22 ` [PATCH 08/44] KVM: Fix cpuid iteration on multiple leaves per eac Avi Kivity
2008-12-09 20:22 ` Avi Kivity [this message]
2008-12-09 20:22 ` [PATCH 10/44] KVM: ppc: fix Kconfig constraints Avi Kivity
2008-12-09 20:22 ` [PATCH 11/44] KVM: ia64: Remove some macro definitions in asm-offsets.c Avi Kivity
2008-12-09 20:22 ` [PATCH 12/44] KVM: Fix kernel allocated memory slot Avi Kivity
2008-12-09 20:22 ` [PATCH 13/44] KVM: ppc: use MMUCR accessor to obtain TID Avi Kivity
2008-12-09 20:22 ` [PATCH 14/44] KVM: ppc: use prefetchable mappings for guest memory Avi Kivity
2008-12-09 20:22 ` [PATCH 15/44] KVM: ppc: fix userspace mapping invalidation on context switch Avi Kivity
2008-12-09 20:22 ` [PATCH 16/44] Merge branch 'x86/crashdump' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip Avi Kivity
2008-12-09 20:22 ` [PATCH 17/44] KVM: VMX: move vmx.h to include/asm Avi Kivity
2008-12-09 20:22 ` [PATCH 18/44] KVM: SVM: move svm.h " Avi Kivity
2008-12-09 20:22 ` [PATCH 19/44] KVM: VMX: move ASM_VMX_* definitions from asm/kvm_host.h to asm/vmx.h Avi Kivity
2008-12-09 20:22 ` [PATCH 20/44] KVM: VMX: move cpu_has_kvm_support() to an inline on asm/virtext.h Avi Kivity
2008-12-09 20:22 ` [PATCH 21/44] x86: asm/virtext.h: add cpu_vmxoff() inline function Avi Kivity
2008-12-09 20:22 ` [PATCH 22/44] KVM: VMX: extract kvm_cpu_vmxoff() from hardware_disable() Avi Kivity
2008-12-09 20:22 ` [PATCH 23/44] x86: cpu_emergency_vmxoff() function Avi Kivity
2008-12-09 20:22 ` [PATCH 24/44] KVM: SVM: move has_svm() code to asm/virtext.h Avi Kivity
2008-12-09 20:22 ` [PATCH 25/44] KVM: SVM: move svm_hardware_disable() " Avi Kivity
2008-12-09 20:22 ` [PATCH 26/44] x86: cpu_emergency_svm_disable() function Avi Kivity
2008-12-09 20:22 ` [PATCH 27/44] kdump: forcibly disable VMX and SVM on machine_crash_shutdown() Avi Kivity
2008-12-09 20:22 ` [PATCH 28/44] x86: disable VMX on all CPUs on reboot Avi Kivity
2008-12-09 20:22 ` [PATCH 29/44] KVM: ia64: Define printk function for kvm-intel module Avi Kivity
2008-12-09 20:22 ` [PATCH 30/44] KVM: ia64: Add some debug points to provide crash infomation Avi Kivity
2008-12-09 20:22 ` [PATCH 31/44] KVM: ia64: Add handler for crashed vmm Avi Kivity
2008-12-09 20:22 ` [PATCH 32/44] KVM: ia64: Clean up vmm_ivt.S using tab to indent every line Avi Kivity
2008-12-09 20:22 ` [PATCH 33/44] KVM: VMX: Conditionally request interrupt window after injecting irq Avi Kivity
2008-12-09 20:22 ` [PATCH 34/44] x86: KVM guest: sign kvmclock as paravirt Avi Kivity
2008-12-09 20:22 ` [PATCH 35/44] KVM: Move ack notifier register and IRQ sourcd ID request Avi Kivity
2008-12-09 20:22 ` [PATCH 36/44] KVM: Separate update irq to a single function Avi Kivity
2008-12-09 20:22 ` [PATCH 37/44] KVM: Replace irq_requested with more generic irq_requested_type Avi Kivity
2008-12-09 20:22 ` [PATCH 38/44] KVM: Clean up assigned_device_update_irq Avi Kivity
2008-12-09 20:22 ` [PATCH 39/44] KVM: Add fields for MSI device assignment Avi Kivity
2008-12-09 20:22 ` [PATCH 40/44] KVM: Export ioapic_get_delivery_bitmask Avi Kivity
2008-12-09 20:22 ` [PATCH 41/44] KVM: Add assigned_device_msi_dispatch() Avi Kivity
2008-12-09 20:22 ` [PATCH 42/44] KVM: Enable MSI for device assignment Avi Kivity
2008-12-09 20:22 ` [PATCH 43/44] KVM: MSI to INTx translate Avi Kivity
2008-12-09 20:22 ` [PATCH 44/44] KVM: MMU: optimize set_spte for page sync Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1228854179-23002-10-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=hollisb@us.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®