summaryrefslogtreecommitdiff
path: root/ldso/libdl
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-01-03 19:55:47 +0000
committerEric Andersen <andersen@codepoet.org>2003-01-03 19:55:47 +0000
commit854603b2a050d4403a3ee11c1abefa1ebc36eba2 (patch)
tree5457a0d3bdf6a7ebc31a4e2f6d3eef90e8d250bb /ldso/libdl
parentf980a783a335d83330e832ed92c0aa8f1abb93b8 (diff)
If they call dlopen with anything other than RTLD_LAZY
or RTLD_NOW then we need to error out.
Diffstat (limited to 'ldso/libdl')
-rw-r--r--ldso/libdl/dlib.c11
-rw-r--r--ldso/libdl/libdl.c11
2 files changed, 18 insertions, 4 deletions
diff --git a/ldso/libdl/dlib.c b/ldso/libdl/dlib.c
index 0b7f7738a..15749ce21 100644
--- a/ldso/libdl/dlib.c
+++ b/ldso/libdl/dlib.c
@@ -132,6 +132,12 @@ void *_dlopen(const char *libname, int flag)
int (*dl_elf_init) (void);
#endif
+ /* A bit of sanity checking... */
+ if (!(flag & RTLD_LAZY|RTLD_NOW)) {
+ _dl_error_number = LD_BAD_HANDLE;
+ return NULL;
+ }
+
from = __builtin_return_address(0);
/* Have the dynamic linker use the regular malloc function now */
@@ -320,14 +326,15 @@ static int do_fixup(struct elf_resolve *tpnt, int flag)
return goof;
tpnt->init_flag |= JMP_RELOCS_DONE;
- if (flag == RTLD_LAZY)
+ if (flag == RTLD_LAZY) {
_dl_parse_lazy_relocation_information(tpnt,
tpnt->dynamic_info[DT_JMPREL],
tpnt->dynamic_info[DT_PLTRELSZ], 0);
- else
+ } else {
goof += _dl_parse_relocation_information(tpnt,
tpnt->dynamic_info[DT_JMPREL],
tpnt->dynamic_info[DT_PLTRELSZ], 0);
+ }
};
return goof;
}
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index 0b7f7738a..15749ce21 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -132,6 +132,12 @@ void *_dlopen(const char *libname, int flag)
int (*dl_elf_init) (void);
#endif
+ /* A bit of sanity checking... */
+ if (!(flag & RTLD_LAZY|RTLD_NOW)) {
+ _dl_error_number = LD_BAD_HANDLE;
+ return NULL;
+ }
+
from = __builtin_return_address(0);
/* Have the dynamic linker use the regular malloc function now */
@@ -320,14 +326,15 @@ static int do_fixup(struct elf_resolve *tpnt, int flag)
return goof;
tpnt->init_flag |= JMP_RELOCS_DONE;
- if (flag == RTLD_LAZY)
+ if (flag == RTLD_LAZY) {
_dl_parse_lazy_relocation_information(tpnt,
tpnt->dynamic_info[DT_JMPREL],
tpnt->dynamic_info[DT_PLTRELSZ], 0);
- else
+ } else {
goof += _dl_parse_relocation_information(tpnt,
tpnt->dynamic_info[DT_JMPREL],
tpnt->dynamic_info[DT_PLTRELSZ], 0);
+ }
};
return goof;
}