在内核调试windows(XP SP3)机器时, 我想找到用户模式地址的页面保护(实际上只是为了检查它是否为No-Execute页面)。
扩展名!vprot(就是这样)在内核调试时不起作用。
我尝试更改为此用户模式地址空间(使用'.process / i'),然后在地址上调用!pte。 但有时候,PTE条目无效,因为它被分页(我认为)。
有什么建议吗?
答案 0 :(得分:3)
您可以尝试组合使用!vad和!address:
0: kd> !process 0 0 calc.exe
PROCESS 89e035f8 SessionId: 0 Cid: 021c Peb: 7ffdd000 ParentCid: 00d4
DirBase: 0aac0200 ObjectTable: e1f587a8 HandleCount: 44.
Image: calc.exe
0: kd> .process /i 89e035f8
使用!vad:
3: kd> !vad 0x1000000
VAD level start end commit
89e02578 (-1) 1000 101e 3 Mapped Exe EXECUTE_WRITECOPY \WINDOWS\system32\calc.exe
3: kd> !vad 0x1014000
VAD level start end commit
89e02578 (-1) 1000 101e 3 Mapped Exe EXECUTE_WRITECOPY \WINDOWS\system32\calc.exe
问题在于!vad只为整个页面范围提供了vad,更准确地说是vad段的大小。显然,0x1000000 [PE Header]和0x1014000 [.data section]的页面没有相同的保护。
使用!地址:
请注意,!address命令会映射很多东西(包括PTE / PFN和VAD):
3: kd> !address 0x1000000
Mapping user range ...
Mapping system range ...
Mapping page tables...
Mapping hyperspace...
Mapping HAL reserved range...
Mapping User Probe Area...
Mapping system shared page...
Mapping system cache working set...
Mapping loader mappings...
Mapping system PTEs...
Mapping system paged pool...
Mapping session space...
Mapping dynamic system space...
Mapping PFN database...
Mapping non paged pool...
Mapping VAD regions...
Mapping module regions...
Mapping process, thread, and stack regions...
Mapping system cache regions...
使用'-v'和'-map'选项:
3: kd> !address -v -map 0x1000000
PDE: c0600040 [contains 20b9a867]
Page Frame Number: 20b9a, at address: 00000000
Page Location: 6 (ActiveAndValid)
PTE Frame: 00020a98
Attributes: M:Modified,Cached
Usage: PTEs Process 89e035f8 [calc.exe], Entries:22
PTE: c0008000 [contains 20d86025]
Page Frame Number: 20d86, at address: 00000000
Page Location: 6 (ActiveAndValid)
PTE Frame: 00020384
Attributes: P:Prototype,M:Modified,Cached
Usage: MappedFile CA:8a1282e0 [\WINDOWS\system32\calc.exe]
Type: Valid
Attrs: Private,NormalPage,NotDirty,NotDirty1,Accessed,User,NotWritable,NotWriteThrough
PFN: 20d86
Attrs输出提供有用的信息。此时您可以使用!pte命令:
3: kd> !pte c0008000
VA 01000000
PDE at C0600040 PTE at C0008000
contains 0000000020B9A867 contains 0000000020D86025
pfn 20b9a ---DA--UWEV pfn 20d86 ----A--UREV
希望能解决你的问题。