summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-elf
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>2003-05-31 14:45:11 +0000
committermdodd <mdodd@FreeBSD.org>2003-05-31 14:45:11 +0000
commitf365a266e11ce21eb038986db228367c55a6de5d (patch)
tree25facbede77df18eef5265ea0f3f0a7dfe942321 /libexec/rtld-elf
parent7283092cef96498fc80c9b2a1822fdc317c704bd (diff)
downloadFreeBSD-src-f365a266e11ce21eb038986db228367c55a6de5d.zip
FreeBSD-src-f365a266e11ce21eb038986db228367c55a6de5d.tar.gz
Use the environment variable LD_LIBMAP_DISABLE to disable
libmap.conf(5) functionality.
Diffstat (limited to 'libexec/rtld-elf')
-rw-r--r--libexec/rtld-elf/rtld.13
-rw-r--r--libexec/rtld-elf/rtld.c11
2 files changed, 11 insertions, 3 deletions
diff --git a/libexec/rtld-elf/rtld.1 b/libexec/rtld-elf/rtld.1
index 3daad6b..5ba43e0 100644
--- a/libexec/rtld-elf/rtld.1
+++ b/libexec/rtld-elf/rtld.1
@@ -83,6 +83,9 @@ recognizes a number of environment variables that can be used to modify
its behaviour as follows:
.Pp
.Bl -tag -width ".Ev LD_LIBRARY_PATH"
+.It Ev LD_LIBMAP_DISABLE
+If set disables the use of
+.Xr libmap.conf 5 .
.It Ev LD_LIBRARY_PATH
A colon separated list of directories, overriding the default search path
for shared libraries.
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 01a1a33..9bbd5d4 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -134,6 +134,7 @@ void r_debug_state(struct r_debug*, struct link_map*);
*/
static char *error_message; /* Message for dlerror(), or NULL */
struct r_debug r_debug; /* for GDB; */
+static bool libmap_disable; /* Disable libmap */
static bool trust; /* False for setuid and setgid programs */
static char *ld_bind_now; /* Environment variable for immediate binding */
static char *ld_debug; /* Environment variable for debugging */
@@ -263,6 +264,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
trust = geteuid() == getuid() && getegid() == getgid();
+ libmap_disable = getenv("LD_LIBMAP_DISABLE") != NULL;
+
ld_bind_now = getenv("LD_BIND_NOW");
if (trust) {
ld_debug = getenv("LD_DEBUG");
@@ -339,7 +342,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
sym_zero.st_shndx = SHN_UNDEF;
#ifdef WITH_LIBMAP
- lm_init();
+ if (!libmap_disable)
+ lm_init();
#endif
dbg("loading LD_PRELOAD libraries");
@@ -795,7 +799,7 @@ find_library(const char *xname, const Obj_Entry *refobj)
}
#ifdef WITH_LIBMAP
- if ((name = lm_find(refobj->path, xname)) == NULL)
+ if (libmap_disable || (name = lm_find(refobj->path, xname)) == NULL)
#endif
name = (char *)xname;
@@ -1434,7 +1438,8 @@ rtld_exit(void)
objlist_call_fini(&list_fini);
/* No need to remove the items from the list, since we are exiting. */
#ifdef WITH_LIBMAP
- lm_fini();
+ if (!libmap_disable)
+ lm_fini();
#endif
}
OpenPOWER on IntegriCloud