Hi,
When I display kernel structures in windbg e.g., KTHREAD in debugger there
are no issues. But, when I programmatically try to access some member of it
e.g., TrapFrame, I get bug check PAGE_FAULT_IN_NONPAGED_AREA. Note also the
bug check happens for some members and for some it don’t.
Here are some details. When I checked the address whose read reference
caused the bug check, I see:
kd> !pte 0xf810ad64
VA f810ad64
PDE at C0300F80 PTE at C03E0428
contains 01010163 contains 0E51ABE2
pfn 1010 -G-DA–KWEV not valid
Transition: e51a
Protect: 1f - ReadWriteCopyExecute WC
It seems address 0xf810ad64 has PTE invalid.
This address is actually the address of TrapFrame member of KTHREAD and
displays correctly in windbg:
kd> dt _KTHREAD 0x8161f540 TrapFrame
+0x134 TrapFrame : 0xf810ad64 _KTRAP_FRAME
kd> dt _KTRAP_FRAME 0xf810ad64
+0x000 DbgEbp : 0x18
+0x004 DbgEip : 0x77f705fa
+0x008 DbgArgMark : 0x705fc
+0x00c DbgArgPointer : 0xc0150008
+0x010 TempSegCs : 0
My question is when windbg shows the structure pointer as valid and does not
complain when we display contents of it, why does we get a bug check error
programmatically. How do we safely access contents of such member variables
of KTHREAD?
Thanks in advance
Chandra