Re:Big problems with ASLR in Ice Cream Sandwich
by eyemac on Friday February 17, 2012 @06:02PM
(#3605333)
> I was under the impression that if you have two or more instances of the same .so/.dll/.dylibs in different processes, and they end up using different virtual addresses then they can't share the same code page. Maybe I'm behind times...
By design, dylibs (i.e. shared dynamic libraries) are allowed to be loaded at different virtual addresses and still have their text/ro sections shared.
Because dylibs are always compiled with -fPIC, they do not have any dependence on their load addresses (branches are pc-relative, data loads go through the GOT, etc). This allows the dyld to map the physical address(es) of a dylib's text/ro section(s) into virtual address spaces of multiple processes with very little relocation.
By design, dylibs (i.e. shared dynamic libraries) are allowed to be loaded at different virtual addresses and still have their text/ro sections shared.
Because dylibs are always compiled with -fPIC, they do not have any dependence on their load addresses (branches are pc-relative, data loads go through the GOT, etc). This allows the dyld to map the physical address(es) of a dylib's text/ro section(s) into virtual address spaces of multiple processes with very little relocation.