mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-06 20:58:33 +01:00
elf: Call la_objclose for proxy link maps in _dl_fini (bug 32065)
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
8f36b14696
commit
c4b160744c
2 changed files with 25 additions and 3 deletions
|
@ -69,6 +69,7 @@ _dl_fini (void)
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
struct link_map *l;
|
struct link_map *l;
|
||||||
|
struct link_map *proxy_link_map = NULL;
|
||||||
assert (nloaded != 0 || GL(dl_ns)[ns]._ns_loaded == NULL);
|
assert (nloaded != 0 || GL(dl_ns)[ns]._ns_loaded == NULL);
|
||||||
for (l = GL(dl_ns)[ns]._ns_loaded, i = 0; l != NULL; l = l->l_next)
|
for (l = GL(dl_ns)[ns]._ns_loaded, i = 0; l != NULL; l = l->l_next)
|
||||||
/* Do not handle ld.so in secondary namespaces. */
|
/* Do not handle ld.so in secondary namespaces. */
|
||||||
|
@ -84,6 +85,11 @@ _dl_fini (void)
|
||||||
are not dlclose()ed from underneath us. */
|
are not dlclose()ed from underneath us. */
|
||||||
++l->l_direct_opencount;
|
++l->l_direct_opencount;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
/* Used below to call la_objclose for the ld.so proxy
|
||||||
|
link map. */
|
||||||
|
proxy_link_map = l;
|
||||||
|
|
||||||
assert (ns != LM_ID_BASE || i == nloaded);
|
assert (ns != LM_ID_BASE || i == nloaded);
|
||||||
assert (ns == LM_ID_BASE || i == nloaded || i == nloaded - 1);
|
assert (ns == LM_ID_BASE || i == nloaded || i == nloaded - 1);
|
||||||
unsigned int nmaps = i;
|
unsigned int nmaps = i;
|
||||||
|
@ -122,6 +128,9 @@ _dl_fini (void)
|
||||||
--l->l_direct_opencount;
|
--l->l_direct_opencount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (proxy_link_map != NULL)
|
||||||
|
_dl_audit_objclose (proxy_link_map);
|
||||||
|
|
||||||
#ifdef SHARED
|
#ifdef SHARED
|
||||||
_dl_audit_activity_nsid (ns, LA_ACT_CONSISTENT);
|
_dl_audit_activity_nsid (ns, LA_ACT_CONSISTENT);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -236,13 +236,26 @@ do_test (int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Lmid_t lmid_other = LM_ID_NEWLM;
|
||||||
|
unsigned int other_namespace_count = 0;
|
||||||
for (size_t i = 0; i < nobjs; i++)
|
for (size_t i = 0; i < nobjs; i++)
|
||||||
{
|
{
|
||||||
/* This subtest currently does not pass because of bug 32065. */
|
if (objs[i].lmid != LM_ID_BASE)
|
||||||
if (! (endswith (objs[i].lname, LD_SO) && objs[i].lmid != LM_ID_BASE))
|
{
|
||||||
TEST_COMPARE (objs[i].closed, true);
|
if (lmid_other == LM_ID_NEWLM)
|
||||||
|
lmid_other = objs[i].lmid;
|
||||||
|
TEST_COMPARE (objs[i].lmid, lmid_other);
|
||||||
|
++other_namespace_count;
|
||||||
|
if (!(endswith (objs[i].lname, "/" LIBC_SO)
|
||||||
|
|| endswith (objs[i].lname, "/" LD_SO)))
|
||||||
|
FAIL ("unexpected object in secondary namespace: %s",
|
||||||
|
objs[i].lname);
|
||||||
|
}
|
||||||
|
TEST_COMPARE (objs[i].closed, true);
|
||||||
free (objs[i].lname);
|
free (objs[i].lname);
|
||||||
}
|
}
|
||||||
|
/* Both libc.so and ld.so should be present. */
|
||||||
|
TEST_COMPARE (other_namespace_count, 2);
|
||||||
|
|
||||||
/* la_activity(LA_ACT_CONSISTENT) should be the last callback received.
|
/* la_activity(LA_ACT_CONSISTENT) should be the last callback received.
|
||||||
Since only one link map may be not-CONSISTENT at a time, this also
|
Since only one link map may be not-CONSISTENT at a time, this also
|
||||||
|
|
Loading…
Add table
Reference in a new issue