DynamoRIO / dynamorio

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

handle execve of a #! script #2091

Open derekbruening opened 7 years ago

derekbruening commented 7 years ago

For late injection I would expect things to mostly work. However, this is not something that we have spent any time on, and we have no tests of it, so there may well be something that is not quite right such as when looking up child config vars or when trying to handle cross-arch (i.e., 32-bit app execs 64-bit child) due to failing to get the proper final ELF binary.

For early injection, however, I would expect DR to actually need to parse the magic comment for correct execution of the proper binary, b/c it passes the app path to itself on the other side. This will be a pain b/c it can recurse up to 4 times through other scripts.

derekbruening commented 7 years ago

The bulk of this is in 1b763ba775b8f43fff347ff90eaa628bdc3af942

derekbruening commented 7 years ago

Please update the docs for this as well, which today say: "When running scripts it is best to explicitly invoke the interpreter rather than invoking the script directly"

derekbruening commented 6 years ago

3115 covers extending this to the initial early injection