I've a confusion regarding load-time relocation, suppose there are two different shared libraries (having no common symbols) viz. "a.so" and "b.so",compiled with -shared option(no -fpic) and
some code "x" is linked with library "a.so" and other independent code "y" is linked with both the libraries.
After loading these codes, common library "a.so" was loaded at different address ??
Clearly dynamic linker/loader has to perform relocation two times resulting in extra computing and moreover library was consuming space in both the process. Doesn't that defeat the whole purpose of the shared libraries ??
Is ASLR the reason behind this ??
So with load-time libraries what have we gained (apart from saved disk space)???
One more question if above assumption is correct then why windows dll (32bit) is not using pic??
Can someone drag me to epiphany??
Load-time relocation and ASLR
-
- Member
- Posts: 62
- Joined: Mon Jan 07, 2013 10:38 am
Re: Load-time relocation and ASLR
ASLR in windows works by calculating some offset at the boot time. This technique might be good for client systems but for servers doesn't it makes the code susceptible ???
Re: Load-time relocation and ASLR
That bootime ASLR offset affects only the kernel. Apps are affected differently every time they're loaded into memory.dansmahajan wrote:ASLR in windows works by calculating some offset at the boot time. This technique might be good for client systems but for servers doesn't it makes the code susceptible ???
-
- Member
- Posts: 62
- Joined: Mon Jan 07, 2013 10:38 am
Re: Load-time relocation and ASLR
Then why to have base address for each DLL ??alexfru wrote:That bootime ASLR offset affects only the kernel. Apps are affected differently every time they're loaded into memory.dansmahajan wrote:ASLR in windows works by calculating some offset at the boot time. This technique might be good for client systems but for servers doesn't it makes the code susceptible ???
Re: Load-time relocation and ASLR
There was life before ASLR! Further, some EXEs and DLLs aren't relocatable and can function only when loaded at a specific address.dansmahajan wrote: Then why to have base address for each DLL ??
-
- Member
- Posts: 62
- Joined: Mon Jan 07, 2013 10:38 am
Re: Load-time relocation and ASLR
Shared library issue was due to lazy loading not because of ASLR. First call was made to the other library resulting in different address and relocation.