From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: Prevent internal slots from being COWed
Date: Tue, 22 Jun 2010 14:17:44 +0300 [thread overview]
Message-ID: <4C209BD8.8030104@redhat.com> (raw)
In-Reply-To: <20100621202334.GA17362@amt.cnet>
On 06/21/2010 11:23 PM, Marcelo Tosatti wrote:
> On Mon, Jun 21, 2010 at 11:18:13AM +0300, Avi Kivity wrote:
>
>> If a process with a memory slot is COWed, the page will change its address
>> (despite having an elevated reference count). This breaks internal memory
>> slots which have their physical addresses loaded into vmcs registers (see
>> the APIC access memory slot).
>>
>> Signed-off-by: Avi Kivity<avi@redhat.com>
>> ---
>> arch/x86/kvm/x86.c | 5 +++++
>> 1 files changed, 5 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index 33156a3..d9a33e6 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -5633,6 +5633,11 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
>> int user_alloc)
>> {
>> int npages = memslot->npages;
>> + int map_flags = MAP_PRIVATE | MAP_ANONYMOUS;
>> +
>> + /* Prevent internal slot pages from being moved by fork()/COW. */
>> + if (memslot->id>= KVM_MEMORY_SLOTS)
>> + map_flags = MAP_SHARED | MAP_ANONYMOUS;
>>
>> /*To keep backward compatibility with older userspace,
>> *x86 needs to hanlde !user_alloc case.
>>
> Forgot to use map_flags below.
>
>
Ouch, corrected and applied.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2010-06-22 11:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-21 8:18 [PATCH 0/2] Fix failures caused by fork() interaction with internal slots Avi Kivity
2010-06-21 8:18 ` [PATCH 1/2] KVM: Keep slot ID in memory slot structure Avi Kivity
2010-06-21 8:18 ` [PATCH 2/2] KVM: Prevent internal slots from being COWed Avi Kivity
2010-06-21 20:23 ` Marcelo Tosatti
2010-06-22 11:17 ` Avi Kivity [this message]
2010-07-06 14:45 ` Andrea Arcangeli
2010-07-06 14:53 ` 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=4C209BD8.8030104@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.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.