From: HANNAS YAYA Issa Subject: Re: Intercepting page access Date: Mon, 20 Apr 2015 17:01:58 +0200 Message-ID: <00a8ad7c6b649ac051df0adfb8698b87@inp-toulouse.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Hi I really really need help. I continue trying to make it work but nothing change. Please I need help :( On Sat, 18 Apr 2015 19:25:52 +0200, HANNAS YAYA Issa wrote: Hi I am working in a research project I want to incercept pages access by guest virtual machine. My approach is setting higher priviledge in pages by setting changing the user/sypervisor priviledge bit in page table entry associated to this page. Here is the piece of code used void remove_access(l1_pgentry_t *pl1e){ l1_pgentry_t ol1e; l1_pgentry_t nl1e; unsigned int nmfn; if(__copy_from_user(&ol1e, pl1e, sizeof(ol1e)) == 0){ nl1e = ol1e; nmfn = l1e_get_pfn(ol1e); if(!(l1e_get_flags(ol1e)&_PAGE_GUEST_KERNEL)) { l1e_remove_flags(nl1e, _PAGE_USER); if(__copy_to_guest(pl1e, &nl1e, sizeof(nl1e)) != 0) printk("entry cannot be copied\n"); flush_tlb_all(); } }else printk("copy from user failed\n"); } the pointer pl1e is obtained when PTE is updated (in do_mm_update). in page fault handler (do_page_fault). I reset the access by this code void reset_access(l1_pgentry_t *pl1e, l1_pgentry_t ol1e) { l1_pgentry_t nl1e = ol1e; l1e_add_flags(nl1e, _PAGE_USER); __copy_to_guest(pl1e, &nl1e, sizeof(nl1e)); flush_tlb_all(); return; } but the problem is that my computer crash and it reboots. I don't know what is wrong with my code. I spend 2 weeks trying to solve this problem but I couldn't. Please I really need your help Thank you