If unsure, simply say Y here.
+config LDSO_LD_LIBRARY_PATH
+ bool "Add LD_LIBRARY_PATH to lib search path"
+ depends on HAVE_SHARED
+ default y
+ help
+ On hardened system it could be useful to disable the use of
+ LD_LIBRARY_PATH environment variable (a colon-separated list of
+ directories in which to search for ELF libraries at execution-time).
+
+ If unsure, simply say Y here.
+
config LDSO_NO_CLEANUP
bool "Disable automatic unloading of dynamically loaded shared objects"
depends on HAVE_SHARED
}
#endif
+#ifdef __LDSO_LD_LIBRARY_PATH__
/* Check in LD_{ELF_}LIBRARY_PATH, if specified and allowed */
if (_dl_library_path) {
_dl_if_debug_dprint("\tsearching LD_LIBRARY_PATH='%s'\n", _dl_library_path);
return tpnt1;
}
}
-
+#endif
/*
* The ABI specifies that RUNPATH is searched after LD_LIBRARY_PATH.
*/
#include LDSO_ELFINTERP
/* Global variables used within the shared library loader */
+#ifdef __LDSO_LD_LIBRARY_PATH__
char *_dl_library_path = NULL; /* Where we look for libraries */
+#endif
#ifdef __LDSO_PRELOAD_ENV_SUPPORT__
char *_dl_preload = NULL; /* Things to be loaded before the libs */
#endif
#ifdef __LDSO_PRELOAD_ENV_SUPPORT__
_dl_preload = _dl_getenv("LD_PRELOAD", envp);
#endif
+#ifdef __LDSO_LD_LIBRARY_PATH__
_dl_library_path = _dl_getenv("LD_LIBRARY_PATH", envp);
+#endif
} else {
static const char unsecure_envvars[] =
#ifdef EXTRA_UNSECURE_ENVVARS
#ifdef __LDSO_PRELOAD_ENV_SUPPORT__
_dl_preload = NULL;
#endif
+#ifdef __LDSO_LD_LIBRARY_PATH__
_dl_library_path = NULL;
+#endif
/* SUID binaries can be exploited if they do LAZY relocation. */
unlazy = RTLD_NOW;
}
tpnt->libname = argv[0];
while (argc > 1)
if (! _dl_strcmp (argv[1], "--library-path") && argc > 2) {
+#ifdef __LDSO_LD_LIBRARY_PATH__
_dl_library_path = argv[2];
+#endif
_dl_skip_args += 2;
argc -= 2;
argv += 2;
const char *_dl_progname = ""; /* Program name */
void *(*_dl_malloc_function)(size_t);
void (*_dl_free_function) (void *p);
+#ifdef __LDSO_LD_LIBRARY_PATH__
char *_dl_library_path = NULL; /* Where we look for libraries */
+#endif
int _dl_errno = 0; /* We can't use the real errno in ldso */
size_t _dl_pagesize = PAGE_SIZE; /* Store the page size for use later */
/* This global variable is also to communicate with debuggers such as gdb. */
if (getenv("LD_BIND_NOW"))
now_flag = RTLD_NOW;
-#ifndef SHARED
+#if !defined SHARED && defined __LDSO_LIBRARY_PATH__
/* When statically linked, the _dl_library_path is not yet initialized */
_dl_library_path = getenv("LD_LIBRARY_PATH");
#endif