All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaspal <jaspal.iiith@gmail.com>
To: kvm@vger.kernel.org
Subject: Using kvm_mmu_remove_write_access to write-protect pages
Date: Mon, 10 Sep 2012 10:44:48 +0530	[thread overview]
Message-ID: <504D7748.1090007@gmail.com> (raw)

Hello ,

I want to capture all the writes taking place in a guest os and tried to 
write-protect the pages using a hypercall in this way ( host with ept , 
guest & host 64 bit linux) :

case 0x99999996 :
                 {
                 struct kvm *kvm=vcpu->kvm;
                 spin_lock(&kvm->mmu_lock);
                 struct kvm_memslots *slots = kvm->memslots;
                 int i = 0;
                 for (i = 0; i < KVM_MEM_SLOTS_NUM; i++){
                         kvm_mmu_slot_remove_write_access(kvm, 
slots->id_to_index[i]);
                 }
                 spin_unlock(&kvm->mmu_lock);
                 }
                 break;
guest kernel module ( to test ) :
         unsigned long addr = __get_free_page(GFP_KERNEL);
         wrmsrl(0x99999996, 0);
         strcpy((char *)addr, "K");
         strcpy((char *)addr, "V");
         strcpy((char *)addr, "M");

How do I mark the ept entries as write-protect again after the first 
strcpy from within kvm itself so that I can catch it in 
kvm_mmu_page_fault with an error_code = 3 ( write + page present ) ?
Also , is it correct to say that shadow page tables are in fact the ept 
tables and shadow page cache , the ept tlb ( where the x86 hardware 
searches for the gva<--> hva translations ) ?

Thanks ,
Jaspal

                 reply	other threads:[~2012-09-10  5:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=504D7748.1090007@gmail.com \
    --to=jaspal.iiith@gmail.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 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.