Skip to contentSkip to conversation

Intercepting page access

DISCUSSION HANNAS YAYA Issa 2 participants 2 messages Apr 20, 2015

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 6 lines · HANNAS YAYA Issa

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