xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* unable to capture an expected page fault
@ 2012-01-17  8:08 Study Xen
  2012-01-17 11:12 ` Tim Deegan
  0 siblings, 1 reply; 3+ messages in thread
From: Study Xen @ 2012-01-17  8:08 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1732 bytes --]

Hello,

I was trying to modify part of Xen and faced a page fault missing issue.

I am testing a PV Linux 64-bit guest (kernel 3.1.1, as dom0, the only
domain in my setting) atop Xen 4.1.2. In an unmodified Xen, the Linux
kernel's "native_set_pte" in "arch/x86/include/asm/pgtable_64.h" traps into
Xen due to Xen's write-protection of the pagetable page. But in our
modified version, this expected page fault seems missing.

I tried to debug and had the following observations.

(1) I have verified that the (L1) pte pointing to the page containing the
faulting vaddr has its R/W=0 so it is indeed write-protected.

(2) In Xen, I have verified that the page_fault interrupt is trapped (the
"set_intr_gate" logic for page fault in xen/arch/x86/traps.c remains
unchanged compared with original Xen).

(3) And I called printk directly from within "ENTRY(page_fault)"
(xen/arch/x86/x86_64/entry.S) in the hope that if the expected faulting
vaddr is detected (my understanding is that ENTRY(page_fault) is the first
code that gets executed in Xen when there is a page fault interrupt, am I
right?), then the printk message will immediately appear. I can see this
debug message if I insert the printk to unmodified Xen's entry.S, but it
does not generate any output in the modified project.

(4) I also checked the value of CR0 just in case the WP bit is mistakenly
cleared. And I found that it was correctly set. (is this really related? I
assume PV is running with CPL==1 so I would like to check this. )

So I was baffled with the situation that modifying a write-protected page
does not generate a page fault that can be intercepted by (modified) Xen.

Could someone suggest some thoughts on my above debugging procedure?

Thanks.

X

[-- Attachment #1.2: Type: text/html, Size: 2068 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

* Re: unable to capture an expected page fault
  2012-01-17  8:08 unable to capture an expected page fault Study Xen
@ 2012-01-17 11:12 ` Tim Deegan
  2012-01-17 18:11   ` Study Xen
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Deegan @ 2012-01-17 11:12 UTC (permalink / raw)
  To: Study Xen; +Cc: xen-devel

Hi, 

At 03:08 -0500 on 17 Jan (1326769684), Study Xen wrote:
> I was trying to modify part of Xen and faced a page fault missing issue.
> 
> I am testing a PV Linux 64-bit guest (kernel 3.1.1, as dom0, the only
> domain in my setting) atop Xen 4.1.2. In an unmodified Xen, the Linux
> kernel's "native_set_pte" in "arch/x86/include/asm/pgtable_64.h" traps into
> Xen due to Xen's write-protection of the pagetable page. But in our
> modified version, this expected page fault seems missing.

Well, I suppose it must be something you changed. :)  But since you don't
say what you changed I'm not sure how much we can help you.  If the
pagetables are indeed correct then maybe you're missing a TLB flush
somewhere?

Tim.

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

* Re: unable to capture an expected page fault
  2012-01-17 11:12 ` Tim Deegan
@ 2012-01-17 18:11   ` Study Xen
  0 siblings, 0 replies; 3+ messages in thread
From: Study Xen @ 2012-01-17 18:11 UTC (permalink / raw)
  To: Tim Deegan; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1476 bytes --]

Hello Tim,

Thanks for your reply. I am actually learning (and the same time trying to
port) the code written by a former student. That is why it is currently
hard for me to clearly explain what have been modified in the code.

The former member's intention was to make use of Xen's ability of modifying
pagetables underneath the guest kernel to achieve data protection of user
applications from a compromised kernel. So his modification scattered into
several places, mainly in Xen's memory management code and interrupt
handling code. Unfortunately I have not been able to pinpoint which code
caused the current bug I mentioned in the previous mail.

X


On Tue, Jan 17, 2012 at 6:12 AM, Tim Deegan <tim@xen.org> wrote:

> Hi,
>
> At 03:08 -0500 on 17 Jan (1326769684), Study Xen wrote:
> > I was trying to modify part of Xen and faced a page fault missing issue.
> >
> > I am testing a PV Linux 64-bit guest (kernel 3.1.1, as dom0, the only
> > domain in my setting) atop Xen 4.1.2. In an unmodified Xen, the Linux
> > kernel's "native_set_pte" in "arch/x86/include/asm/pgtable_64.h" traps
> into
> > Xen due to Xen's write-protection of the pagetable page. But in our
> > modified version, this expected page fault seems missing.
>
> Well, I suppose it must be something you changed. :)  But since you don't
> say what you changed I'm not sure how much we can help you.  If the
> pagetables are indeed correct then maybe you're missing a TLB flush
> somewhere?
>
> Tim.
>

[-- Attachment #1.2: Type: text/html, Size: 1990 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

end of thread, other threads:[~2012-01-17 18:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-17  8:08 unable to capture an expected page fault Study Xen
2012-01-17 11:12 ` Tim Deegan
2012-01-17 18:11   ` Study Xen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).