Android 4.2 - LD_PRELOAD is supported or not?

I wonder if LD_PRELOAD is supported by newer Android versions?

During 4.0 ICS this was not the case, and the documentation (NDK docs / SYSTEM-ISSUES.html) also has:

No support for LD_LIBRARY_PATH, LD_PRELOAD, RTLD_LOCAL and many other options.

      

But a few days ago I used LD_LIBRARY_PATH on my Android 4.2 Galaxy Nexus and it worked (!).

Thanks in advance!

+3


source to share


2 answers


Generally speaking, LD_LIBRARY_PATH

worked on engineering builds (aka rooted devices) for quite some time. The problem is that it doesn't help to create the assembly - not because the loader has changed, but because the environment for your application is protected.



0


source


Although the official NDK-r9d documentation still says the same thing, it turns out that LD_PRELOAD does work on rooted devices. Run

adb shell
setprop wrap.com.xyz.yourapp LD_PRELOAD=/path/to/your/library.so
stop
start

      



after clicking library to device. I tried this on ANDROID-19 emulator to provide an alternative function definition.

Check out this link - http://cedricvb.be/post/intercepting-android-native-library-calls/

+5


source







All Articles