[haiku-development] Re: shared library areas?

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 09 Aug 2011 16:09:17 +0200

On 2011-08-09 at 07:38:21 [+0200], Dustin Howett <alaricx@xxxxxxxxx> wrote:
> On Aug 8, 2011 7:17 PM, <pete.goodeve@xxxxxxxxxxxx> wrote:
> > I'm puzzled.  Why do multiple instances of a library show different
> > addresses (with listarea) in Haiku, when -- as I would expect -- they
> > all have the same address in BeOS?
> 
> ASLR (Address Space Layout Randomization), maybe. I'm not sure if it's
> implemented in the Haiku kernel, but it would handily explain randomized
> address space layouts.

No, that isn't implemented in Haiku yet. The simple reason is that the 
virtual address ranges where libraries are loaded are allocated by the 
runtime loader on a first-come-first-served basis. The size of the program 
determines where the first library is put and the library order might vary 
as well. BeOS perhaps uses a different algorithm. BONE/Dan0 have a 
kernel-based runtime loader which seems to cache shared objects -- probably 
already relocated, so that assigning the same address is highly 
advantageous. Plain BeOS R5 has a userland runtime loader, too, so I guess 
it's less likely that you'll see the same addresses.

CU, Ingo

Other related posts: