mirror of
git://sourceware.org/git/glibc.git
synced 2025-01-18 12:16:13 +08:00
[BZ #116]
Update. * elf/dl-load.c (_dl_map_object): If __RTLD_CALLMAP flag is set, reset loader before the actual loading. * elf/dl-open.c (dl_open_worker): If file name contains no path element determine map of caller. Pass caller map in this case to _dl_map_object. Set __RTLD_CALLMAP in mode. * include/dlfcn.h (__RTLD_CALLMAP): Define. [BZ #116] Patch by Greg Wolodkin <greg@mathworks.com>.
This commit is contained in:
parent
807645d725
commit
c14e91352e
@ -1,5 +1,13 @@
|
|||||||
2004-08-08 Ulrich Drepper <drepper@redhat.com>
|
2004-08-08 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* elf/dl-load.c (_dl_map_object): If __RTLD_CALLMAP flag is set,
|
||||||
|
reset loader before the actual loading.
|
||||||
|
* elf/dl-open.c (dl_open_worker): If file name contains no path
|
||||||
|
element determine map of caller. Pass caller map in this case to
|
||||||
|
_dl_map_object. Set __RTLD_CALLMAP in mode.
|
||||||
|
* include/dlfcn.h (__RTLD_CALLMAP): Define. [BZ #116]
|
||||||
|
Patch by Greg Wolodkin <greg@mathworks.com>.
|
||||||
|
|
||||||
* misc/syslog.c (openlog_internal): Always try both UDP and TCP.
|
* misc/syslog.c (openlog_internal): Always try both UDP and TCP.
|
||||||
[BZ #108] Patch mainly by Bjorn Andersson <bjorn@iki.fi>.
|
[BZ #108] Patch mainly by Bjorn Andersson <bjorn@iki.fi>.
|
||||||
|
|
||||||
|
@ -1914,6 +1914,12 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* In case the LOADER information has only been provided to get to
|
||||||
|
the appropriate RUNPATH/RPATH information we do not need it
|
||||||
|
anymore. */
|
||||||
|
if (mode & __RTLD_CALLMAP)
|
||||||
|
loader = NULL;
|
||||||
|
|
||||||
if (__builtin_expect (fd, 0) == -1)
|
if (__builtin_expect (fd, 0) == -1)
|
||||||
{
|
{
|
||||||
if (trace_mode
|
if (trace_mode
|
||||||
|
@ -163,32 +163,24 @@ dl_open_worker (void *a)
|
|||||||
const char *file = args->file;
|
const char *file = args->file;
|
||||||
int mode = args->mode;
|
int mode = args->mode;
|
||||||
struct link_map *new, *l;
|
struct link_map *new, *l;
|
||||||
const char *dst;
|
|
||||||
int lazy;
|
int lazy;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
#ifdef USE_TLS
|
#ifdef USE_TLS
|
||||||
bool any_tls;
|
bool any_tls;
|
||||||
#endif
|
#endif
|
||||||
|
struct link_map *call_map = NULL;
|
||||||
|
|
||||||
/* Check whether _dl_open() has been called from a valid DSO. */
|
/* Check whether _dl_open() has been called from a valid DSO. */
|
||||||
if (__check_caller (args->caller_dl_open, allow_libc|allow_libdl) != 0)
|
if (__check_caller (args->caller_dl_open, allow_libc|allow_libdl) != 0)
|
||||||
GLRO(dl_signal_error) (0, "dlopen", NULL, N_("invalid caller"));
|
GLRO(dl_signal_error) (0, "dlopen", NULL, N_("invalid caller"));
|
||||||
|
|
||||||
/* Maybe we have to expand a DST. */
|
/* Determine the caller's map if necessary. This is needed in case
|
||||||
dst = strchr (file, '$');
|
we have a DST or when the file name has no path in which case we
|
||||||
if (__builtin_expect (dst != NULL, 0))
|
need to look along the RUNPATH/RPATH of the caller. */
|
||||||
|
const char *dst = strchr (file, '$');
|
||||||
|
if (dst != NULL || strchr (file, '/') == NULL)
|
||||||
{
|
{
|
||||||
const void *caller_dlopen = args->caller_dlopen;
|
const void *caller_dlopen = args->caller_dlopen;
|
||||||
size_t len = strlen (file);
|
|
||||||
size_t required;
|
|
||||||
struct link_map *call_map;
|
|
||||||
char *new_file;
|
|
||||||
|
|
||||||
/* DSTs must not appear in SUID/SGID programs. */
|
|
||||||
if (__libc_enable_secure)
|
|
||||||
/* This is an error. */
|
|
||||||
GLRO(dl_signal_error) (0, "dlopen", NULL,
|
|
||||||
N_("DST not allowed in SUID/SGID programs"));
|
|
||||||
|
|
||||||
/* We have to find out from which object the caller is calling. */
|
/* We have to find out from which object the caller is calling. */
|
||||||
call_map = NULL;
|
call_map = NULL;
|
||||||
@ -205,6 +197,21 @@ dl_open_worker (void *a)
|
|||||||
if (call_map == NULL)
|
if (call_map == NULL)
|
||||||
/* In this case we assume this is the main application. */
|
/* In this case we assume this is the main application. */
|
||||||
call_map = GL(dl_loaded);
|
call_map = GL(dl_loaded);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Maybe we have to expand a DST. */
|
||||||
|
if (__builtin_expect (dst != NULL, 0))
|
||||||
|
{
|
||||||
|
size_t len = strlen (file);
|
||||||
|
size_t required;
|
||||||
|
char *new_file;
|
||||||
|
|
||||||
|
/* DSTs must not appear in SUID/SGID programs. */
|
||||||
|
if (__libc_enable_secure)
|
||||||
|
/* This is an error. */
|
||||||
|
GLRO(dl_signal_error) (0, "dlopen", NULL,
|
||||||
|
N_("DST not allowed in SUID/SGID programs"));
|
||||||
|
|
||||||
|
|
||||||
/* Determine how much space we need. We have to allocate the
|
/* Determine how much space we need. We have to allocate the
|
||||||
memory locally. */
|
memory locally. */
|
||||||
@ -223,10 +230,15 @@ dl_open_worker (void *a)
|
|||||||
|
|
||||||
/* Now we have a new file name. */
|
/* Now we have a new file name. */
|
||||||
file = new_file;
|
file = new_file;
|
||||||
|
|
||||||
|
/* It does not matter whether call_map is set even if we
|
||||||
|
computed it only because of the DST. Since the path contains
|
||||||
|
a slash the value is not used. See dl-load.c. */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load the named object. */
|
/* Load the named object. */
|
||||||
args->map = new = GLRO(dl_map_object) (NULL, file, 0, lt_loaded, 0, mode);
|
args->map = new = GLRO(dl_map_object) (call_map, file, 0, lt_loaded, 0,
|
||||||
|
mode | __RTLD_CALLMAP);
|
||||||
|
|
||||||
/* If the pointer returned is NULL this means the RTLD_NOLOAD flag is
|
/* If the pointer returned is NULL this means the RTLD_NOLOAD flag is
|
||||||
set and the object is not already loaded. */
|
set and the object is not already loaded. */
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#define __RTLD_DLOPEN 0x80000000
|
#define __RTLD_DLOPEN 0x80000000
|
||||||
#define __RTLD_SPROF 0x40000000
|
#define __RTLD_SPROF 0x40000000
|
||||||
#define __RTLD_OPENEXEC 0x20000000
|
#define __RTLD_OPENEXEC 0x20000000
|
||||||
|
#define __RTLD_CALLMAP 0x10000000
|
||||||
|
|
||||||
/* Now define the internal interfaces. */
|
/* Now define the internal interfaces. */
|
||||||
extern void *__dlvsym (void *__handle, __const char *__name,
|
extern void *__dlvsym (void *__handle, __const char *__name,
|
||||||
|
@ -391,8 +391,6 @@ __libc_res_nquerydomain(res_state statp,
|
|||||||
const char *longname = nbuf;
|
const char *longname = nbuf;
|
||||||
int n, d;
|
int n, d;
|
||||||
|
|
||||||
write(2,"<<aaaa\n",7);
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (statp->options & RES_DEBUG)
|
if (statp->options & RES_DEBUG)
|
||||||
printf(";; res_nquerydomain(%s, %s, %d, %d)\n",
|
printf(";; res_nquerydomain(%s, %s, %d, %d)\n",
|
||||||
@ -423,11 +421,8 @@ __libc_res_nquerydomain(res_state statp,
|
|||||||
}
|
}
|
||||||
sprintf(nbuf, "%s.%s", name, domain);
|
sprintf(nbuf, "%s.%s", name, domain);
|
||||||
}
|
}
|
||||||
int r = (__libc_res_nquery(statp, longname, class, type, answer,
|
return (__libc_res_nquery(statp, longname, class, type, answer,
|
||||||
anslen, answerp));
|
anslen, answerp));
|
||||||
write(2,">>aaaa\n",7);
|
|
||||||
return r;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user