Questions tagged [library-interposition]

This is a practice to override a call to the function from library by the developer's own implementation. Dedicated to add monitoring and/or debugging stuff into functions like malloc().

This is a practice reached by features of dynamic linker to override a call in the application to the function from library by the developer's own implementation. Such mechanism is dedicated to add monitoring and/or debugging stuff into functions like malloc(), realloc(), free().

GNU linker ld allows to do that thanks to the LD_PRELOAD environment variable, which cause the indicated ELF dynamic library to be loaded prior to other libraries linked with the application being executed.

21 questions
0
votes
1 answer

Interpositioning fscanf only under certain conditions

So I'm trying to override the fscanf function in c, but I only want different behavior to occur if certain conditions are met; if those conditions are not met, I want to just call the original fscanf. I know that you can use dlsym to use the…
anon
  • 35
  • 5
0
votes
0 answers

Run-time library interposition for sleep() function in C

I'm having a slight problem with interpositioning the sleep function at run time. I'm currently trying to test library interpositioning at runtime using a simple source code, "sleepdemo.c" and "wakeup.c". The code(wakeup.c) I have wrote is as…
MasterGL
  • 111
  • 10
0
votes
0 answers

Interposing code into an existing apk

Is it possible, given an existing apk, to interpose method calls? What about arbitrary lines of code? Ideally I would like to be able to intercept a method call/line of code and call my own method to do some checks or logging and then let the…
0
votes
4 answers

Find out if a received pointer is a string, ushort or array

I am interposing the memcpy() function in C because the target application uses it to concatenate strings and I want to find out which strings are being created. The code is: void * my_memcpy ( void * destination, const void * source, size_t num…
flaab
  • 543
  • 9
  • 19
0
votes
1 answer

How to hook system calls of my android app

I want to intercept the connect() system call and use my own custom implementation. The custom implementation will do some action like printing a log for simplicity and then call the system implementation further. I looked at Audrey's blog where the…
0
votes
1 answer

Interposing library: XOpenDisplay

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…
1
2