I want to know if someone could access libraries with function addresses that would be the same from one instance of the program to the other?
Asked
Active
Viewed 920 times
1 Answers
4
The address space layout will be pretty consistent from run to run on the same device. A lot of the major system libraries are preloaded by zygote, and so inherited as shared mappings by the children it forks off to differentiate into applications. I suppose remapping them at the virtual memory level would be possible, but would incur a sort of dynamic-re-linking penalty and would be fairly tricky to implement.

Chris Stratton
- 39,853
- 6
- 84
- 117
-
1Is zygote not run in virtual memory? It should be the same addresses then if the new process if forked? (I am assuming shared libraries are loaded in the memory space of the application?) Do you know where I can find more information on the Android architecture? – Dpp May 10 '11 at 05:16
-
1Many key shared libraries are loaded once by zygote, and then applications get them as copy-on-write pages (which they normally don't) - so they don't cost any more physical memory other than for accounting. To put them at random addresses, you'd have to mremap them and fix all the broken linkage between the loaded libraries which would result, incurring not only a time cost but having to allocate private copies of their procedure linkage tables since you'd be changing them with new addresses. – Chris Stratton May 10 '11 at 08:35