function-interposition

Function interposition in Linux without dlsym

I'm currently working on a project where I need to track the usage of several system calls and low-level functions like mmap, brk, sbrk. So far, I've been doing this using function interposition: I write a wrapper function with the same name as the function I'm replacing (mmap for example), and I load it in a program by setting the LD_P...

Interposing library: XOpenDisplay

Hello, I am working on a project where I need to change the behaviour of the XOpenDisplay function defined in X11/Xlib.h. I have found an example, which should do exactly what I am looking for, but when I compile it, I get the following error messages: XOpenDisplay_interpose.c:14: Error: conflicting types for »XOpenDisplay« /usr...

Checkpointing and restarting X11 applications

My task is to checkpoint and restart X11 applications. Therefore I use the BLCR (Berkeley Lab Checkpoint/Restart (BLCR)) tool. Due to the fact that BLCR is not able (without modifications) to reinitiate the connection to the X-Server, I used an interposition library to log all Xlib function calls with their parameters to a text file. ...

[macosx]does dlopen call open and read functions?

Hello, I've intercepted(interposed) dlopen function under MacOS X and some other functions. I see how my applications calls dlopen in the log, but don't find anything related to open/read functions after dynamic library was dlopened. How does the system accesses and reads the dynamic library file? I've looked at the source code of dyld,...

How to catch unintentional function interpositioning?

Reading through my book Expert C Programming, I came across the chapter on function interpositioning and how it can lead to some serious hard to find bugs if done unintentionally. The example given in the book is the following: my_source.c mktemp() { ... } main() { mktemp(); getwd(); } libc mktemp(){ ... } getwd(){ ...; mktemp...