From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sheng Yang Subject: Re: [PATCH 1/1] KVM: Fix kernel allocated memory slot Date: Wed, 12 Nov 2008 09:52:29 +0800 Message-ID: <200811120952.30232.sheng@linux.intel.com> References: <1226388640-32200-1-git-send-email-sheng@linux.intel.com> <1226415505.458.5.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Cc: Avi Kivity , kvm@vger.kernel.org To: Hollis Blanchard Return-path: Received: from mga09.intel.com ([134.134.136.24]:51903 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751342AbYKLBzi (ORCPT ); Tue, 11 Nov 2008 20:55:38 -0500 In-Reply-To: <1226415505.458.5.camel@localhost.localdomain> Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: On Tuesday 11 November 2008 22:58:25 Hollis Blanchard wrote: > On Tue, 2008-11-11 at 15:30 +0800, Sheng Yang wrote: > > Commit 7fd49de9773fdcb7b75e823b21c1c5dc1e218c14 "KVM: ensure that memslot > > userspace addresses are page-aligned" broke kernel space allocated memory > > slot, for the userspace_addr is invalid. > > > > Signed-off-by: Sheng Yang > > --- > > virt/kvm/kvm_main.c | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > > index 0a0a959..4727c08 100644 > > --- a/virt/kvm/kvm_main.c > > +++ b/virt/kvm/kvm_main.c > > @@ -715,7 +715,7 @@ 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)) > > + if (user_alloc && (mem->userspace_addr & (PAGE_SIZE - 1))) > > goto out; > > if (mem->slot >= KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS) > > goto out; > > Wow, I didn't realize we still had kernel-allocated guest memory. Why is > that? > > Anyways, the above patch seems fine to me. > Acked-by: Hollis Blanchard it's for VMX EPT and APIC access page, as well as TSS pages. We are planning to change that in the future, but I think it's a quick fix for now. Thanks. -- regards Yang, Sheng