Closed
Description
SPI now suffers from recursive instrumentation, where the instrumented function is called when we are inside the instrumentation code.
One example is: SPI instruments the new operator at plt section. When we are running the instrumentation code, it calls the new operator and triggered the instrumentation code again. This causes an infinite recursion.
Ideal solution is to implement the trampGuard similar to the one in dyninstAPI. The trampGuard checks if we are inside instrumentation code or not. It skips instrumentation if it detects that it is inside the instrumentation code.
A workaround now is to discover all the functions that can cause recursive instrumentation and specifically avoid instrumenting them.