summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2012-08-31 19:44:04 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2012-08-31 19:44:04 +0000
commit422ddc23c4e88892762a10dd2ec29b43ff3b98ab (patch)
tree154aa83fb6f2ef87683f372fdc1252fb4e33bff4
parent6ee82dd644b80b938b7c9d3093c5c9ccb019ddd9 (diff)
Since _dl_debug_map is only initialized if we see a DT_DEBUG tag, make sure
it isn't NULL before we dereference it. Fixes perl PIE on hppa. ok matthew@, deraadt@
-rw-r--r--libexec/ld.so/dlfcn.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/libexec/ld.so/dlfcn.c b/libexec/ld.so/dlfcn.c
index 9ab7380690e..552df474f73 100644
--- a/libexec/ld.so/dlfcn.c
+++ b/libexec/ld.so/dlfcn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dlfcn.c,v 1.86 2012/06/12 20:32:16 matthew Exp $ */
+/* $OpenBSD: dlfcn.c,v 1.87 2012/08/31 19:44:03 kettenis Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -71,7 +71,7 @@ dlopen(const char *libname, int flags)
_dl_thread_kern_stop();
- if (_dl_debug_map->r_brk) {
+ if (_dl_debug_map && _dl_debug_map->r_brk) {
_dl_debug_map->r_state = RT_ADD;
(*((void (*)(void))_dl_debug_map->r_brk))();
}
@@ -130,7 +130,7 @@ dlopen(const char *libname, int flags)
loaded:
_dl_loading_object = NULL;
- if (_dl_debug_map->r_brk) {
+ if (_dl_debug_map && _dl_debug_map->r_brk) {
_dl_debug_map->r_state = RT_CONSISTENT;
(*((void (*)(void))_dl_debug_map->r_brk))();
}
@@ -264,15 +264,14 @@ dlclose(void *handle)
_dl_thread_kern_stop();
- if (_dl_debug_map->r_brk) {
+ if (_dl_debug_map && _dl_debug_map->r_brk) {
_dl_debug_map->r_state = RT_DELETE;
(*((void (*)(void))_dl_debug_map->r_brk))();
}
retval = _dl_real_close(handle);
-
- if (_dl_debug_map->r_brk) {
+ if (_dl_debug_map && _dl_debug_map->r_brk) {
_dl_debug_map->r_state = RT_CONSISTENT;
(*((void (*)(void))_dl_debug_map->r_brk))();
}