mapping shared libraries at fixed address...
John Reiser
jreiser@BitWagon.com
Wed Jan 18 20:14:00 GMT 2006
François-René ÃVB Rideau asked:
> So as to be able to mmap BIG data files on i386, I would like to get
> the shared libraries out of the way.
http://bitwagon.com/tub.html points to a hack that has worked at times.
> There are three problems:
> (1) ld.so itself is defined as a shared library with no load address
> specification, and the kernel loads it at TASK_UNMAPPED_BASE.
If you're really going for fixed addresses, then build ld.so as ET_EXEC
with some particular base. On the gcc link commandline: omit "-shared",
then add "-Wl,-Ttext,ORG". Or, you can change 0x08048000 in the output
of "ld --verbose", then use it as a linker script with argument
"-Wl,--script=SCRIPTFILE".
> (2) ld.so itself must load things at a lower address ...
> (3) the libc itself might use mmap(0,...) ...
Intercepting {mmap, mmap2, mremap} works if you can find them all.
Change the instruction stream to redirect control to your own code
that has its own versions of these routines. The "tub" hack does this.
--
More information about the Libc-alpha
mailing list