All of lore.kernel.org
 help / color / mirror / Atom feed
* Intercepting page access
@ 2015-04-18 17:25 HANNAS YAYA Issa
  0 siblings, 0 replies; 3+ messages in thread
From: HANNAS YAYA Issa @ 2015-04-18 17:25 UTC (permalink / raw)
  To: xen-devel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Intercepting page access
@ 2015-04-20 15:01 HANNAS YAYA Issa
  2015-04-20 15:16 ` Andrew Cooper
  0 siblings, 1 reply; 3+ messages in thread
From: HANNAS YAYA Issa @ 2015-04-20 15:01 UTC (permalink / raw)
  To: xen-devel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Intercepting page access
  2015-04-20 15:01 Intercepting page access HANNAS YAYA Issa
@ 2015-04-20 15:16 ` Andrew Cooper
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2015-04-20 15:16 UTC (permalink / raw)
  To: xen-devel

On 20/04/15 16:01, HANNAS YAYA Issa wrote:
> Hi
> I really really need help. I continue trying to make it work but
> nothing change.
> Please I need help :(
>
>

Please read an x86 architecture manual before trying to play blindly in
the dark, and particularly the permission checks in paging mode.  Doing
so might explain why setting the supervisor bit is not an appropriate
solution to your problem.

~Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-20 15:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-20 15:01 Intercepting page access HANNAS YAYA Issa
2015-04-20 15:16 ` Andrew Cooper
  -- strict thread matches above, loose matches on Subject: below --
2015-04-18 17:25 HANNAS YAYA Issa

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.