Libc's environ is zero on Android/Intel

北城以北 提交于 2019-12-11 04:42:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!