summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2016-12-22 17:44:27 +0000
committerMark Johnston <markj@FreeBSD.org>2016-12-22 17:44:27 +0000
commit57a9273f9323ef4687d352dc187432974a0ffbe5 (patch)
treeae80a1c4e5bc6b1697a118d0c16b7711a9da9ab2 /libexec
parent510fe58c824384e0a8c1bad8d8866c92f83b2d25 (diff)
downloadsrc-test2-57a9273f9323ef4687d352dc187432974a0ffbe5.tar.gz
src-test2-57a9273f9323ef4687d352dc187432974a0ffbe5.zip
Notes
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/rtld.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 10711da25bb1..50e1a0e9105a 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -90,6 +90,7 @@ static const char *gethints(bool);
static void hold_object(Obj_Entry *);
static void unhold_object(Obj_Entry *);
static void init_dag(Obj_Entry *);
+static void init_marker(Obj_Entry *);
static void init_pagesizes(Elf_Auxinfo **aux_info);
static void init_rtld(caddr_t, Elf_Auxinfo **);
static void initlist_add_neededs(Needed_Entry *, Objlist *);
@@ -1829,6 +1830,14 @@ init_dag(Obj_Entry *root)
root->dag_inited = true;
}
+static void
+init_marker(Obj_Entry *marker)
+{
+
+ bzero(marker, sizeof(*marker));
+ marker->marker = true;
+}
+
Obj_Entry *
globallist_curr(const Obj_Entry *obj)
{
@@ -3566,8 +3575,7 @@ dl_iterate_phdr(__dl_iterate_hdr_callback callback, void *param)
RtldLockState bind_lockstate, phdr_lockstate;
int error;
- bzero(&marker, sizeof(marker));
- marker.marker = true;
+ init_marker(&marker);
error = 0;
wlock_acquire(rtld_phdr_lock, &phdr_lockstate);
@@ -4419,7 +4427,7 @@ trace_loaded_objects(Obj_Entry *obj)
static void
unload_object(Obj_Entry *root)
{
- Obj_Entry *obj, *obj1;
+ Obj_Entry marker, *obj, *next;
assert(root->refcount == 0);
@@ -4430,7 +4438,8 @@ unload_object(Obj_Entry *root)
unlink_object(root);
/* Unmap all objects that are no longer referenced. */
- TAILQ_FOREACH_SAFE(obj, &obj_list, next, obj1) {
+ for (obj = TAILQ_FIRST(&obj_list); obj != NULL; obj = next) {
+ next = TAILQ_NEXT(obj, next);
if (obj->marker || obj->refcount != 0)
continue;
LD_UTRACE(UTRACE_UNLOAD_OBJECT, obj, obj->mapbase,
@@ -4444,7 +4453,16 @@ unload_object(Obj_Entry *root)
TAILQ_REMOVE(&obj_list, obj, next);
obj_count--;
- unload_filtees(root);
+ if (obj->filtees_loaded) {
+ if (next != NULL) {
+ init_marker(&marker);
+ TAILQ_INSERT_BEFORE(next, &marker, next);
+ unload_filtees(obj);
+ next = TAILQ_NEXT(&marker, next);
+ TAILQ_REMOVE(&obj_list, &marker, next);
+ } else
+ unload_filtees(obj);
+ }
release_object(obj);
}
}