This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mapping shared libraries at fixed address...


Dear Jakub,

> With the flexible mmap memory layout in 2.6.9 and later this shouldn't be
> an issue.
It looks like an interesting approach, if I can convince the
administrators to upgrade kernel for all/most of my server farm.
However, half an hour of Googling around and peering at the source
doesn't find me some reliable documentation on how this feature is
meant to be used. I understand that I must somehow set the kernel
personality and exec, but I'm not quite sure how to do it. Can you
hint me with a clue stick?

> If for whatever reason 2.6.9+ doesn't DTRT for you, you can:
> 1) use prelink and tell it where to mmap the libraries (with --exec-shield
>    option it will by default put libraries below binaries if possible)
> 2) if you don't want to have libraries prelinked, you can just use
>    prelink -r 0x12345000 /lib/ld-2.3.*.so that will just relocate
>    ld.so (and similarly for other libraries you need)
Will try that too! But will that convince the libc to mmap its locale
data out of the way? Otherwise, I might still have to preload an
interceptor for mmap...

Before you told me about prelink, I managed to cheat the linker into
producing a ld.so that specifies a fixed load address (first, changing
the ld script to specify such an address, then changing ET_DYN==3 into
ET_EXEC==2 into offset 16 of the binary) -- that's evil but it's all I
had found to convince the kernel to load it at fixed address. That (or
preferrably prelink if it works) plus an interception of mmap (patch
to ld.so if no prelink on old kernels, LD_PRELOAD to use unchanged
libc) will do the trick if I can't DTRT with recent kernels most
everywhere. (Many thanks to Alexandre Julliard for the example of a
working preloader.)

Thanks a lot for your support.

[ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ]
Pacifism is a shifty doctrine under which a man accepts the benefits of the
social group without being willing to pay - and claims a halo for his
dishonesty. -- Robert Heinlein


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]