diff options
author | dillon <dillon@FreeBSD.org> | 2002-06-22 18:36:21 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2002-06-22 18:36:21 +0000 |
commit | 7b9815cfbebc18bbc15daea92d4f6bfe511fa38b (patch) | |
tree | 458b0224bcffec8a0352f8cfc61a391b53c71cba /libexec/rtld-elf/sparc64 | |
parent | e904c7f5434bb9ebfeb97d1f2a5c31d76781e853 (diff) | |
download | FreeBSD-src-7b9815cfbebc18bbc15daea92d4f6bfe511fa38b.zip FreeBSD-src-7b9815cfbebc18bbc15daea92d4f6bfe511fa38b.tar.gz |
The last bits of the alloca -> mmap fix. IA64 and SPARC64 (current only).
Untested (testing request went unanswered), but sparc64 is not expected to
cause problems. IA64 is not expected to cause problems but the patch was
slightly more complex so the possibility exists.
Approved by: jdp
Diffstat (limited to 'libexec/rtld-elf/sparc64')
-rw-r--r-- | libexec/rtld-elf/sparc64/reloc.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libexec/rtld-elf/sparc64/reloc.c b/libexec/rtld-elf/sparc64/reloc.c index 1a897c3..db1ffe3 100644 --- a/libexec/rtld-elf/sparc64/reloc.c +++ b/libexec/rtld-elf/sparc64/reloc.c @@ -249,18 +249,29 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld) const Elf_Rela *relalim; const Elf_Rela *rela; 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)); relalim = (const Elf_Rela *)((caddr_t)obj->rela + obj->relasize); for (rela = obj->rela; rela < relalim; rela++) { if (reloc_nonplt_object(obj, rela, cache) < 0) - return (-1); + goto done; } - - return (0); + r = 0; +done: + if (cache) + munmap(cache, bytes); + return (r); } static int |