Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Apr 2003 22:35:43 -0400 (EDT)
From:      Daniel Eischen <eischen@pcnet1.pcnet.com>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        threads@freebsd.org
Subject:   Re: Question about rtld-elf. Anyone?.. Anyone?
Message-ID:  <Pine.GSO.4.10.10304302232170.21688-100000@pcnet1.pcnet.com>
In-Reply-To: <3EB0845A.FA34BA04@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help

> Peter Wemm wrote:
> > As John said, the problem is twofold.  One is the symbol resolution itself,
> > eg: when you access a function for the first time, a lazy binding call
> > happens.  He had ideas about how to make that fully reentrant.
> 
> It doesn't need to be; the pointer update is atomic, so it's safe

I don't think it is atomic.  Take a look at rtld-elf.c.

> for two threads in the same process at the same time (or there
> would have been much more spectacular fireworks, before now), and
> if it happens over a fork(), then the child process gets a stale
> copy, and does the lazy binding call itself, triggering a COW in
> the page where the lazy-bound verion should have been.  Either way,
> it still works (you just get an extra page in the child that you
> wouldn't have had, had you waited).

It works in libc_r because libc_r uses signals for its scheduling
quantum and rtld masks out signals while holding write locks.

It works in libthr (I'm assuming) because the kernel doesn't
use POSIX scheduling and always makes sure each thread gets
quantum.

-- 
Dan Eischen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10304302232170.21688-100000>