All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Sheng Yang <sheng@linux.intel.com>
Cc: Hollis Blanchard <hollisb@us.ibm.com>,
	Avi Kivity <avi@redhat.com>,
	kvm@vger.kernel.org
Subject: Re: [PATCH 1/1] KVM: Fix kernel allocated memory slot
Date: Tue, 11 Nov 2008 19:59:30 -0600	[thread overview]
Message-ID: <491A3882.5040908@codemonkey.ws> (raw)
In-Reply-To: <200811120952.30232.sheng@linux.intel.com>

Sheng Yang wrote:
> 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 <sheng@linux.intel.com>
>>> ---
>>>  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 <hollisb@us.ibm.com>
>>     
>
> 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.
>   

It's also there to support older userspaces that still rely on the 
kernel allocating guest memory.  This is only applicable to x86 though.

Regards,

Anthony Liguori

> Thanks.
>
>   


  reply	other threads:[~2008-11-12  1:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-11  7:14 [ kvm-Bugs-2260759 ] Can not boot up guest on latest kvm commit a605af SourceForge.net
2008-11-11  7:30 ` [PATCH 1/1] KVM: Fix kernel allocated memory slot Sheng Yang
2008-11-11 14:58   ` Hollis Blanchard
2008-11-12  1:52     ` Sheng Yang
2008-11-12  1:59       ` Anthony Liguori [this message]
2008-11-12 10:09     ` Avi Kivity
2008-11-12 10:07   ` 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=491A3882.5040908@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=hollisb@us.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=sheng@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.