freebsd-src/libexec/rtld-elf/i386
Matthew Dillon b603db3019 In tracking down an installation seg fault with then openoffice port
Martin Blapp determined that the elf dynamic loader was at fault.  In
particular, the loader uses alloca() to allocate a symbol cache on the
stack.  Normally this would work just fine, but if the loader is called
from a threaded program and the object being loaded is fairly large the
alloca() can blow away the thread stack and effect other nearby thread
stacks as well.  My testing showed that the symbol cache can be as large
as 250KBytes during the openoffice port build and install sequence.  Martin
was able to work around the problem by disabling the symbol cache
(cache = NULL;).  However, this solution is not adequate for commit because
it can cause an enormous cpu burden for applications which do a lot of
dynamic loading (e.g. like konqueror).

The solution is to use anonymous mmap() to temporarily allocate space to
hold the symbol cache.  In testing I found that replacing the alloca()
with mmap() has no observable degredation in performance.

It should be noted that this bug does not necessarily cause an immediate
crash but can instead result in long term corruption and instability in
applications that load modules from threads.  The bug is almost certainly
responsible for some of the instabilities found in konqueror, for example,
and possibly netscape too.

Sleuthing work by: Martin Blapp <mb@imp.ch>
X-MFC after:	Before or after the 4.6 release depending on the release engineers
2002-06-10 18:52:31 +00:00
..
elf_rtld.x Eliminate all machine-dependent code from the main source body and 1999-04-09 00:28:43 +00:00
lockdflt.c Fix a bug which could cause programs with user threads packages to 2000-07-17 17:18:13 +00:00
Makefile.inc Eliminate all machine-dependent code from the main source body and 1999-04-09 00:28:43 +00:00
reloc.c In tracking down an installation seg fault with then openoffice port 2002-06-10 18:52:31 +00:00
rtld_machdep.h Update rtld for the "new" ia64 ABI. In the old toolchain, the 2001-10-29 10:10:10 +00:00
rtld_start.S $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00