commit | 259c182a75ce80112bcad329c97ada8d56ba854d | [log] [tgz] |
---|---|---|
author | Derek Bruening <bruening@google.com> | Fri Jan 25 05:41:19 2019 |
committer | GitHub <noreply@github.com> | Fri Jan 25 05:41:19 2019 |
tree | 759cb47958c78ef0e9241e22b10de5324d22b44a | |
parent | 8ed57e3e4509ded79f09e8e90d54b0174d042d9d [diff] |
i#3356: work around AMD gs base context switch bug (#3357) Adds work-arounds for an AMD processor bug where the processor does not clear the hidden gs base when the gs selector is written. Pre-4.7 Linux kernels leave the prior thread's base in place on a switch due to this. When we attach and receive SIGUSR2 in a new thread, we can thus get the wrong dcontext; worse, we can get NULL in the handler but the wrong dcontext later during init. To solve the problem on attach, we check the tid for threads receiving a takeover signal. For incorrect tid cases or unknown threads we set a non-zero "pre-init" value (the kernel ignores zero) in the gs base. We have to be careful to not clobber the valid gs base value of a temporarily-native thread whose magic field was deliberately set to invalid. On detach, we now set a non-zero value rather than zero in the gs base. When sending a thread native or cloning a child thread, we're already leaving a copy of our base in place (with an invalid .magic field), which eliminates any problems there. Manually tested on an AMD machine with an older kernel: api.startstop succeeded 1000 times in a row where before it failed every single run. Fixes #3356
DynamoRIO is a runtime code manipulation system that supports code transformations on any part of a program, while it executes. DynamoRIO exports an interface for building dynamic tools for a wide variety of uses: program analysis and understanding, profiling, instrumentation, optimization, translation, etc. Unlike many dynamic tool systems, DynamoRIO is not limited to insertion of callouts/trampolines and allows arbitrary modifications to application instructions via a powerful IA-32/AMD64/ARM/AArch64 instruction manipulation library. DynamoRIO provides efficient, transparent, and comprehensive manipulation of unmodified applications running on stock operating systems (Windows, Linux, or Android) and commodity IA-32, AMD64, ARM, and AArch64 hardware. Mac OSX support is in progress.
Tools built on DynamoRIO and provided in our release package include:
DynamoRIO‘s powerful API abstracts away the details of the underlying infrastructure and allows the tool builder to concentrate on analyzing or modifying the application’s runtime code stream. API documentation is included in the release package and can also be browsed online. Slides from our past tutorials are also available.
DynamoRIO is available free of charge as a binary package for both Windows and Linux. DynamoRIO's source code is available under a BSD license.
Use the discussion list to ask questions.
To report a bug, use the issue tracker.
See also the DynamoRIO home page: http://dynamorio.org/