page fault handling in Xen
Hi Tim
in case of second fault that will occur when guest will try to write in GPT(which is readonly)
and faulting address would be of Page table in which the write is attempted. VM exit will occur and xen would execute following code
in file xen-3.0.3_0-src\xen\arch\mm\shadow\multi.c in the page fault handler
static int sh_page_fault(struct vcpu *v,
unsigned long va, struct cpu_user_regs *regs)
{
...
...
[line 2949]
// Was it a write fault?
//
if ( regs->error_code & PFEC_write_access )
{
// //if error is write access and RW permission is not present
if ( unlikely(!(accumulated_gflags & _PAGE_RW)) )
{
perfc_incrc(shadow_fault_bail_ro_mapping);
goto not_a_shadow_fault;
}...
..
Above code will execute and in inner unlikely condition will be true as PT table is read only and error is write_access and control will go to not_a_shadow_fault?
so when the emulation code would be executed for the write that has been performed on read only guest PT for adding entry in guest page table by guest?
Have I missed some thing here in understanding
kindly provide your valuable reply
jeet
----- Original Message ----
From: Tim Deegan <[email protected]>
To: jeet <[email protected]>
Cc: [email protected]
Sent: Friday, 2 March, 2007 7:05:43 PM
Subject: Re: [Xen-devel] page fault handling in Xen
Quoted 1 line · jeet
Is shadow code implementation in xen 3.0.3 is same as explained by you in reply?
Yes.
Cheers,
Tim.
Signature · 16 lines
Tim Deegan <[email protected]>, XenSource UK Limited Registered office c/o EC2Y 5EB, UK; company number 05334508 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xensource.com/xen-devel __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/
Quoted 9 lines · jeet
Above code will execute and in inner unlikely condition will be true as PT table is read only and error is
write_access
and control will go tonot_a_shadow_fault?so when the emulation code would be executed for the write that has been performed on read only guest PT for adding entry in
guest page table by guest?Have I missed some thing here in understanding
Yes: guest PTs are mapped with write permissions in the guest PTs. It's only in the shadow PTs that the guest PTs are mapped read-only. The test on accumulated_gflags is looking at the access permissions in the guest PTs.
-- Keir