mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-01 10:06:57 +03:00
Update.
* elf/link.h (link_map): Add l_dev and l_ino. * elf/dl-load.c (_dl_map_object_from_fd): Test dev/ino of newly loaded shared object with all laoded objects. Initialize l_ino and l_dev in case it's new. * elf/rtld.c (dl_main): Explain situation is l_dev/l_ino with main object. * elf/Makefile: Compile and run new test. * elf/multiload.c: New file.
This commit is contained in:
@ -602,10 +602,15 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname,
|
||||
int type;
|
||||
char *readbuf;
|
||||
ssize_t readlength;
|
||||
struct stat st;
|
||||
|
||||
/* Get file information. */
|
||||
if (__fstat (fd, &st) < 0)
|
||||
lose (errno, "cannot stat shared object");
|
||||
|
||||
/* Look again to see if the real name matched another already loaded. */
|
||||
for (l = _dl_loaded; l; l = l->l_next)
|
||||
if (! strcmp (realname, l->l_name))
|
||||
if (l->l_ino == st.st_ino && l->l_dev == st.st_dev)
|
||||
{
|
||||
/* The object is already loaded.
|
||||
Just bump its reference count and return it. */
|
||||
@ -961,6 +966,10 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname,
|
||||
l->l_scope[0] = &l->l_symbolic_searchlist;
|
||||
}
|
||||
|
||||
/* Finally the file information. */
|
||||
l->l_dev = st.st_dev;
|
||||
l->l_ino = st.st_ino;
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user