DynamoRIO / DynamoRIO/dynamorio
mcontext.pc in syscall events is wow64 do-syscall gencode rather than application pc
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 31
Description
_From [bruen...@google.com](https://code.google.com/u/109494838902877177630/) on December 15, 2011 16:34:23_
issue #442 added mcontext.pc for syscall events: but while it may end up being a nice app pc on other platforms, for win7 wow64 it's not:
dr_fragment_app_pc() doesn't help:
child thread 4236 has pc 0x1f541f00 => 0x1f541f00
0:000> .frame 4
04 1f51ed9c 10171194 drmemorylib!report_child_thread+0xfc8 [e:\src\drmemory\git\src\drmemory\report.c @ 2390]
0:000> dt mc
Local var @ 0x1f51ec44 Type _dr_mcontext_t
+0x000 size : 0x148
+0x004 flags : 3 (No matching name)
+0x008 xdi : 4
+0x008 edi : 4
+0x00c xsi : 1
+0x00c esi : 1
+0x010 xbp : 0x4ff788
+0x010 ebp : 0x4ff788
+0x014 xsp : 0x4ff5b8
+0x014 esp : 0x4ff5b8
+0x018 xbx : 0
+0x018 ebx : 0
+0x01c xdx : 0x25e3a8
+0x01c edx : 0x25e3a8
+0x020 xcx : 0x251d0000
+0x020 ecx : 0x251d0000
+0x024 xax : 0
+0x024 eax : 0
+0x028 xflags : 0x246
+0x028 eflags : 0x246
+0x02c xip : 0x1f541f00 "d???"
+0x02c pc : 0x1f541f00 "d???"
+0x02c eip : 0x1f541f00 "d???"
+0x030 padding : [24] "???"
+0x048 ymm : [8] _dr_ymm_t
0:000> U 0x1f541f00
1f541f00 64ff15c0000000 call dword ptr fs:[000000c0]
1f541f07 a31c844c1f mov [1f4c841c],eax
1f541f0c b8441d216f mov eax,0x6f211d44
1f541f11 e92afbffff jmp 1f541a40
and taking retaddr doesn't help b/c the top one points at the
post-wow64-call:
0:000> dds 0x4ff5b8
004ff5b8 1f541f07
004ff5bc 75f535bf KERNELBASE!CreateRemoteThreadEx+0x161
004ff5c0 004ff64c +0x49f64b
004ff5c4 001fffff +0x19fffe
004ff5c8 00000000
0:000> U 75f535bf -6
KERNELBASE!CreateRemoteThreadEx+0x15b:
75f535b9 ff156413f475 call dword ptr [KERNELBASE!_imp__NtCreateThreadEx (75f41364)]
75f535bf 8985c8feffff mov [ebp-0x138],eax
75f535c5 3bc3 cmp eax,ebx
0:000> U poi(75f41364)
ntdll!NtCreateThreadEx:
771b0894 e9392a3aa8 jmp 1f5532d2
771b0899 33c9 xor ecx,ecx
_Original issue: http://code.google.com/p/dynamorio/issues/detail?id=640_
Contributor guide
Assessment
This issue has not been assessed yet.