Question about rtld-elf. Anyone?.. Anyone?

Terry Lambert tlambert2 at mindspring.com
Wed Apr 30 19:28:59 PDT 2003


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
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).

> The second problem was preventing dlopen() and friends being
> called in parallel.  It sounds like you've dealt with only the
> second problem...

I don't think the first problem needs to be dealt with at all; I
don't think dealing with the second problem is something you want
anyway (see other post, and see chapter 12 of the corrigenda).

I think the real prolem is that the threaded code in question is
broken, and thinks that the thread that was involuntarily
preempted should be restarted, instead of the highest priority
thread available, when it gets its next quantum.

In other words, the code was written to expect a specific type
of pthreads implementation, and is failing to comply with POSIX.

-- Terry


More information about the freebsd-threads mailing list