From owner-cvs-all Mon Jun 10 11:52:38 2002 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 2AC6437B408; Mon, 10 Jun 2002 11:52:32 -0700 (PDT) Received: (from dillon@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g5AIqWd98998; Mon, 10 Jun 2002 11:52:32 -0700 (PDT) (envelope-from dillon) Message-Id: <200206101852.g5AIqWd98998@freefall.freebsd.org> From: Matt Dillon Date: Mon, 10 Jun 2002 11:52:32 -0700 (PDT) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/libexec/rtld-elf/i386 reloc.c X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG dillon 2002/06/10 11:52:32 PDT Modified files: libexec/rtld-elf/i386 reloc.c Log: 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 X-MFC after: Before or after the 4.6 release depending on the release engineers Revision Changes Path 1.9 +20 -8 src/libexec/rtld-elf/i386/reloc.c To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message