From 5a2a1d75043138e696222ced4560de2fb90b8024 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 3 May 2010 08:08:28 -0700 Subject: Don't deadlock in __dl_iterate_phdr while (un)loading objects. --- elf/dl-load.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'elf/dl-load.c') diff --git a/elf/dl-load.c b/elf/dl-load.c index d8f9131..0adddf5 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -803,6 +803,8 @@ lose (int code, int fd, const char *name, char *realname, struct link_map *l, (void) __close (fd); if (l != NULL) { + /* We modify the list of loaded objects. */ + __rtld_lock_lock_recursive (GL(dl_load_write_lock)); /* Remove the stillborn object from the list and free it. */ assert (l->l_next == NULL); if (l->l_prev == NULL) @@ -813,6 +815,7 @@ lose (int code, int fd, const char *name, char *realname, struct link_map *l, l->l_prev->l_next = NULL; --GL(dl_ns)[l->l_ns]._ns_nloaded; free (l); + __rtld_lock_unlock_recursive (GL(dl_load_write_lock)); } free (realname); -- cgit v1.1