mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-16 06:52:27 +00:00
rtld: fix dlopen() for an object that is already mapped but not yet initialized
(cherry picked from commit 1005d3d053
)
This commit is contained in:
parent
542497245d
commit
05e7db731d
|
@ -3758,7 +3758,6 @@ static Obj_Entry *
|
||||||
dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags,
|
dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags,
|
||||||
int mode, RtldLockState *lockstate)
|
int mode, RtldLockState *lockstate)
|
||||||
{
|
{
|
||||||
Obj_Entry *old_obj_tail;
|
|
||||||
Obj_Entry *obj;
|
Obj_Entry *obj;
|
||||||
Objlist initlist;
|
Objlist initlist;
|
||||||
RtldLockState mlockstate;
|
RtldLockState mlockstate;
|
||||||
|
@ -3775,7 +3774,6 @@ dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags,
|
||||||
}
|
}
|
||||||
GDB_STATE(RT_ADD,NULL);
|
GDB_STATE(RT_ADD,NULL);
|
||||||
|
|
||||||
old_obj_tail = globallist_curr(TAILQ_LAST(&obj_list, obj_entry_q));
|
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
if (name == NULL && fd == -1) {
|
if (name == NULL && fd == -1) {
|
||||||
obj = obj_main;
|
obj = obj_main;
|
||||||
|
@ -3788,9 +3786,9 @@ dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags,
|
||||||
obj->dl_refcount++;
|
obj->dl_refcount++;
|
||||||
if (mode & RTLD_GLOBAL && objlist_find(&list_global, obj) == NULL)
|
if (mode & RTLD_GLOBAL && objlist_find(&list_global, obj) == NULL)
|
||||||
objlist_push_tail(&list_global, obj);
|
objlist_push_tail(&list_global, obj);
|
||||||
if (globallist_next(old_obj_tail) != NULL) {
|
|
||||||
/* We loaded something new. */
|
if (!obj->init_done) {
|
||||||
assert(globallist_next(old_obj_tail) == obj);
|
/* We loaded something new and have to init something. */
|
||||||
if ((lo_flags & RTLD_LO_DEEPBIND) != 0)
|
if ((lo_flags & RTLD_LO_DEEPBIND) != 0)
|
||||||
obj->symbolic = true;
|
obj->symbolic = true;
|
||||||
result = 0;
|
result = 0;
|
||||||
|
|
Loading…
Reference in a new issue