Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jun 2002 12:03:48 +0200 (CEST)
From:      Martin Blapp <mb@imp.ch>
To:        Alexandr Kovalenko <never@nevermind.kiev.ua>, "Carlos F. A. Paniago" <pan@panix.ecof.org.br>, Tim Tretyak <timothy@umc.com.ua>, =?ISO-8859-1?Q?Joachim_Str=F6mbergson?= <watchman@ludd.luth.se>, Huang wen hui <huang@ns.gddsn.org.cn>, <trish@bsdunix.net>, Alexander Kabaev <ak03@gte.com>, Pat Lashley <patl+freebsd@volant.org>, Dave Goode <dave@davegoode.net>, "Erik H. Bakke" <ebakke@trolltech.com>, Mark Russell <mark@mark.net.au>, Oliver Braun <obraun@Informatik.unibw-muenchen.DE>, Larry Rosenman <ler@lerctr.org>, David Liebeherr <concept-server@gmx.net>, Steve Kargl <sgk@troutmask.apl.washington.edu>, Peter Ulrich Kruppa <root@pukruppa.de>, <ports@freebsd.org>
Subject:   System rtld fix for Openoffice (ports only)
Message-ID:  <20020610114528.E29168-100000@levais.imp.ch>

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

Hi all,

Matt Dillon has fixed the openoffice setup install problem. Maybe
we will get a MFC which just disables the SymCache for the RELEASE.

Since the package does not use the OO setup for the whole install
(this already happened on the machine building the package), this
problem is only if someone builds the ports himself.

The problem also exists in CURRENT.

The effect of the problem is a coredumping installation, which does
leave a half installed Openoffice back. The setup programm will then
tell you about setup.ins missing.

> The problem appears to be when the loader is called from a thread.
> Threads do not have large stacks... typically only 64K, but the symbol
> cache can be huge and the dynamic loader allocates it on the stack using
> alloca()!  In the case of open-office there are several dynamically
> loaded modules with symbol caches exceeded 250 Kilobytes.

If you have already tried to install OO but is has failed starting setup
afer you have installed, just do this:

1.) Apply the patch
2.) cd /src/libexec/rtld-elf/
3.) make depend && make && make install
4.) cd /usr/ports/editors/openoffice
5.) make deinstall, make reinstall

Can you please test this too ?

Martin

Index: i386/reloc.c
===================================================================
RCS file: /home/ncvs/src/libexec/rtld-elf/i386/reloc.c,v
retrieving revision 1.6.2.1
diff -u -r1.6.2.1 reloc.c
--- i386/reloc.c	11 May 2001 00:57:25 -0000	1.6.2.1
+++ i386/reloc.c	9 Jun 2002 22:34:09 -0000
@@ -115,10 +115,18 @@
 	const Elf_Rel *rellim;
 	const Elf_Rel *rel;
 	SymCache *cache;
+	int bytes = obj->nchains * sizeof(SymCache);
+	int r = -1;

-	cache = (SymCache *)alloca(obj->nchains * sizeof(SymCache));
+	/*
+	 * The dynamic loader may be called from a thread, we have
+	 * limited amounts of stack available so we cannot use alloca().
+	 */
+	cache = mmap(NULL, bytes, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0);
+	if (cache == MAP_FAILED)
+	    cache = NULL;
 	if (cache != NULL)
-	    memset(cache, 0, obj->nchains * sizeof(SymCache));
+	    memset(cache, 0, bytes);

 	rellim = (const Elf_Rel *) ((caddr_t) obj->rel + obj->relsize);
 	for (rel = obj->rel;  rel < rellim;  rel++) {
@@ -137,7 +145,7 @@
 		    def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj,
 		      false, cache);
 		    if (def == NULL)
-			return -1;
+			goto done;

 		    *where += (Elf_Addr) (defobj->relocbase + def->st_value);
 		}
@@ -156,7 +164,7 @@
 		    def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj,
 		      false, cache);
 		    if (def == NULL)
-			return -1;
+			goto done;

 		    *where +=
 		      (Elf_Addr) (defobj->relocbase + def->st_value) -
@@ -174,7 +182,7 @@
 		if (!obj->mainprog) {
 		    _rtld_error("%s: Unexpected R_386_COPY relocation"
 		      " in shared library", obj->path);
-		    return -1;
+		    goto done;
 		}
 		break;

@@ -186,7 +194,7 @@
 		    def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj,
 		      false, cache);
 		    if (def == NULL)
-			return -1;
+			goto done;

 		    *where = (Elf_Addr) (defobj->relocbase + def->st_value);
 		}
@@ -200,10 +208,14 @@
 		_rtld_error("%s: Unsupported relocation type %d"
 		  " in non-PLT relocations\n", obj->path,
 		  ELF_R_TYPE(rel->r_info));
-		return -1;
+		goto done;
 	    }
 	}
-    return 0;
+	if (cache)
+	    munmap(cache, bytes);
+    r = 0;
+done:
+    return(r);
 }

 /* Process the PLT relocations. */


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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