From: Marcelo Tosatti <mtosatti@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: avi@redhat.com, aarcange@redhat.com, kvm@vger.kernel.org
Subject: Re: [patch 2/3] KVM: dont require read-only host ptes
Date: Tue, 5 Oct 2010 10:47:20 -0300 [thread overview]
Message-ID: <20101005134720.GA28632@amt.cnet> (raw)
In-Reply-To: <20101005134301.GQ11145@redhat.com>
On Tue, Oct 05, 2010 at 03:43:01PM +0200, Gleb Natapov wrote:
> > --- kvm.orig/arch/x86/kvm/mmu.c
> > +++ kvm/arch/x86/kvm/mmu.c
> > @@ -2273,6 +2273,7 @@ static int nonpaging_map(struct kvm_vcpu
> > {
> > int r;
> > int level;
> > + int writable;
> > pfn_t pfn;
> > unsigned long mmu_seq;
> >
> > @@ -2289,10 +2290,10 @@ static int nonpaging_map(struct kvm_vcpu
> >
> > mmu_seq = vcpu->kvm->mmu_notifier_seq;
> > smp_rmb();
> > - pfn = gfn_to_pfn(vcpu->kvm, gfn);
> > + pfn = gfn_to_pfn(vcpu->kvm, gfn, &writable);
> >
> > /* mmio */
> > - if (is_error_pfn(pfn))
> > + if (is_error_pfn(pfn) || !writable)
> > return kvm_handle_bad_page(vcpu->kvm, gfn, pfn);
> >
> > spin_lock(&vcpu->kvm->mmu_lock);
> > @@ -2581,6 +2582,8 @@ static int tdp_page_fault(struct kvm_vcp
> > pfn_t pfn;
> > int r;
> > int level;
> > + int writable;
> > + int write = error_code & PFERR_WRITE_MASK;
> > gfn_t gfn = gpa >> PAGE_SHIFT;
> > unsigned long mmu_seq;
> >
> > @@ -2597,15 +2600,14 @@ static int tdp_page_fault(struct kvm_vcp
> >
> > mmu_seq = vcpu->kvm->mmu_notifier_seq;
> > smp_rmb();
> > - pfn = gfn_to_pfn(vcpu->kvm, gfn);
> > - if (is_error_pfn(pfn))
> > + pfn = gfn_to_pfn(vcpu->kvm, gfn, &writable);
> > + if (is_error_pfn(pfn) || !writable)
> Why would we fail read only access to read only memory? Shouldn't we
> check access type here?
>
> --
> Gleb.
Next patch does that.
next prev parent reply other threads:[~2010-10-05 16:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-05 11:54 [patch 0/3] allow read-only memory mappings Marcelo Tosatti
2010-10-05 11:54 ` [patch 1/3] KVM: VMX: remove setting of shadow_base_ptes for EPT Marcelo Tosatti
2010-10-05 11:55 ` [patch 2/3] KVM: dont require read-only host ptes Marcelo Tosatti
2010-10-05 13:43 ` Gleb Natapov
2010-10-05 13:47 ` Marcelo Tosatti [this message]
2010-10-05 11:55 ` [patch 3/3] KVM: handle " Marcelo Tosatti
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=20101005134720.GA28632@amt.cnet \
--to=mtosatti@redhat.com \
--cc=aarcange@redhat.com \
--cc=avi@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@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