DynamoRIO / dynamorio

Dynamic Instrumentation Tool Platform
Other
2.67k stars 562 forks source link

handle app using same segment register #107

Open derekbruening opened 9 years ago

derekbruening commented 9 years ago

From derek.br...@gmail.com on April 02, 2009 23:10:32

this was PR 205276: use fs/gs segment transparently on linux

we do not currently handle an app that uses the segment register we do (the one that pthreads does not use). that means we will have issues w/ wine.

Original issue: http://code.google.com/p/dynamorio/issues/detail?id=107

derekbruening commented 9 years ago

From qin.zhao@gmail.com on April 12, 2011 12:40:34

The issue is mostly fixed by revision 724 . We keep this issue open till the code is better tested and more robust.

derekbruening commented 9 years ago

From qin.zhao@gmail.com on April 12, 2011 15:02:43

We resolve this issue in revision 718 by mangling the application's memory reference via FS/GS. For example, for instruction: mov [%fs:0x10] => %rax, we can change it to mov app-fs-base => %rax mov [%rax, 0x10] => %rax

There are 3 areas to be handled:

  1. mangle all memory reference via fs/gs
  2. mangle instructions that update/query fs/gs
  3. monitor system calls and maintain information about application's tls segment.

There are some corner cases are not handled yet, including

  1. indirect branch using xcx and seg, e.g. [%fs:ecx]
  2. support get TSL segment base (now only enabled when private_loader is on)
  3. check segment bound on mangled far memory access if the segment size is not unlimited.
  4. update/query seg might cause access violation which should be handled.
  5. handle system call modify_ldt if necessary
  6. add testing cases