问题
Why would the value of libc
's global variable environ
be zero on Android/Intel?
I have a piece of third party native code that unconditionally dereferences environ
as provided by libc
. It occasionally crashes on Android Intel devices; last time observed on ASUS ME371MG tablet with Intel Atom Z2420 under Android 4.2.1. I could not reproduce it on the emulator with the same 4.2.1.
The code in question is in a shared object (SO) startup code. The startup code is being invoked, judging by the crash stack, by the first method call into said SO (as performed from yet another SO).
I've never seen this crash on Android/ARM systems.
I wonder if I can fix that by forcibly setting environ
to something sensible from the caller code. When multiple SO's are loaded into a process, do they share the libc data?
Related to this.
来源:https://stackoverflow.com/questions/16868297/libcs-environ-is-zero-on-android-intel