riboseinc / retrace

retrace is a versatile security vulnerability / bug discovery tool through monitoring and modifying the behavior of compiled binaries on Linux, OpenBSD/FreeBSD/NetBSD (shared object) and macOS (dynamic library).
Other
60 stars 19 forks source link

Retrace v2 segfaults in macOS #384

Closed pablo-mendoza closed 5 years ago

pablo-mendoza commented 5 years ago

Retrace v2 doesn't seem to work at all on macOS, crashes on the simplest program

pablo-mendoza commented 5 years ago

This all comes down to failure to initialize because

retrace_as_get_real_safe("time"); retrace_as_get_real_safe("localtime_r");

Both return NULL.

I'm using xcode 10.1, which comes with:

$ clang -v Apple LLVM version 10.0.0 (clang-1000.11.45.5) Target: x86_64-apple-darwin17.7.0

I don't understand why yet.

This simple program

include

include

include

int main(void) { void handle = dlopen(NULL, RTLD_LOCAL); void time = dlsym(handle, "time"); printf("time pointer is %p\n", time); }

does returns the correct pointer for time()

pablo-mendoza commented 5 years ago

Fixed by #387, but there are still some issues remaining in macOS