summaryrefslogtreecommitdiff
path: root/libexec/ld.so/loader.c
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2002-08-11 16:51:05 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2002-08-11 16:51:05 +0000
commit473832b4224d696359623031c03115a7f9c5a702 (patch)
tree2da7c2487a20a2b825c3c3e0d41cb15be5d6709b /libexec/ld.so/loader.c
parent8f0370394306356488cffa83b9a1e2de8282b759 (diff)
Fix for Elfbug, the Xtiherit problem which has been seen on most OpenBSD
ELF dynamic systems. This was due to an oddity in ELF where the address of fuctions refer to the PLT address in the program, rather than the actual function address.
Diffstat (limited to 'libexec/ld.so/loader.c')
-rw-r--r--libexec/ld.so/loader.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c
index f70edab0e97..333a720625c 100644
--- a/libexec/ld.so/loader.c
+++ b/libexec/ld.so/loader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: loader.c,v 1.44 2002/08/09 14:35:43 art Exp $ */
+/* $OpenBSD: loader.c,v 1.45 2002/08/11 16:51:04 drahn Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -255,7 +255,7 @@ _dl_boot(const char **argv, char **envp, const long loff,
Elf_Addr ooff;
sym = NULL;
- ooff = _dl_find_symbol("atexit", _dl_objects, &sym, 0, 0);
+ ooff = _dl_find_symbol("atexit", _dl_objects, &sym, 0, 0, 1);
if (sym == NULL) {
_dl_printf("cannot find atexit, destructors will not be run!\n");
} else {
@@ -531,14 +531,14 @@ _dl_call_init(elf_object_t *object)
* XXX that should be fixed.
*/
sym = NULL;
- ooff = _dl_find_symbol("__CTOR_LIST__", object, &sym, 1, 1);
+ ooff = _dl_find_symbol("__CTOR_LIST__", object, &sym, 1, 1, 1);
if (sym != NULL) {
int i = *(int *)(sym->st_value + ooff);
while (i--)
*(int *)(sym->st_value + ooff + 4 + 4 * i) += ooff;
}
sym = NULL;
- ooff = _dl_find_symbol("__DTOR_LIST__", object, &sym, 1, 1);
+ ooff = _dl_find_symbol("__DTOR_LIST__", object, &sym, 1, 1, 1);
if (sym != NULL) {
int i = *(int *)(sym->st_value + ooff);
while (i--)
@@ -551,7 +551,7 @@ _dl_call_init(elf_object_t *object)
* XXX Instead we rely on a symbol named '.init' and call it if it exists.
*/
sym = NULL;
- ooff = _dl_find_symbol(".init", object, &sym, 1, 1);
+ ooff = _dl_find_symbol(".init", object, &sym, 1, 1, 1);
if (sym != NULL) {
DL_DEB(("calling .init in '%s'\n",object->load_name));
(*(void(*)(void))(sym->st_value + ooff))();