freebsd-src/libexec/rtld-elf
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
..
alpha ld-elf.so.1 assumed a few too many things about the ordering of sections 2002-02-18 02:24:10 +00:00
amd64 In tracking down an installation seg fault with then openoffice port 2002-06-10 18:52:31 +00:00
i386 In tracking down an installation seg fault with then openoffice port 2002-06-10 18:52:31 +00:00
ia64 Include machine/ia64_cpu.h because we use ia64_mf(). 2002-05-21 00:04:08 +00:00
sparc64 rtld support for sparc64. 2002-03-13 02:40:39 +00:00
debug.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
debug.h Use STD{ERR,IN,OUT}_FILENO instead of their numeric values. The 2001-07-26 11:02:39 +00:00
Makefile Use new backup feature of install(1). 2001-05-28 16:58:35 +00:00
malloc.c Change brk's prototype from char *brk(const char *) to int brk(const void *) 2002-01-24 12:11:31 +00:00
map_object.c Add ia64 support. Various adjustments were made to existing targets to 2001-10-15 18:48:42 +00:00
rtld.1 Add support such that if LD_TRACE_LOADED_OBJECTS_ALL is defined to a 2002-02-17 07:04:32 +00:00
rtld.c Fix handling of weak references to undefined symbols on ia64: 2002-04-27 05:32:51 +00:00
rtld.h Update rtld for the "new" ia64 ABI. In the old toolchain, the 2001-10-29 10:10:10 +00:00
xmalloc.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00