about summary refs log tree commit diff
path: root/elf/rtld.c
diff options
context:
space:
mode:
authorAndreas Krebbel <Andreas.Krebbel@de.ibm.com>2010-10-26 00:23:14 -0400
committerUlrich Drepper <drepper@redhat.com>2010-10-26 00:23:14 -0400
commitf09677388a44cd1460f8986ef1b096c73bd5b958 (patch)
treebe86216cc5afa7ce2e708c53fef206468b675bd9 /elf/rtld.c
parentdbf3a06904168417a05882a871342e7a9ee3b383 (diff)
downloadglibc-f09677388a44cd1460f8986ef1b096c73bd5b958.tar.gz
glibc-f09677388a44cd1460f8986ef1b096c73bd5b958.tar.xz
glibc-f09677388a44cd1460f8986ef1b096c73bd5b958.zip
Fix concurrency problem between dl_open and dl_iterate_phdr
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 06b534a559..23b3462490 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1113,6 +1113,10 @@ of this helper program; chances are you did not intend to run this program.\n\
       main_map->l_phnum = phnum;
       main_map->l_entry = *user_entry;
 
+      /* Even though the link map is not yet fully initialized we can add
+	 it to the map list since there are no possible users running yet.  */
+      _dl_add_to_namespace_list (main_map, LM_ID_BASE);
+
       /* At this point we are in a bit of trouble.  We would have to
 	 fill in the values for l_dev and l_ino.  But in general we
 	 do not know where the file is.  We also do not handle AT_EXECFD
@@ -1255,7 +1259,7 @@ of this helper program; chances are you did not intend to run this program.\n\
       /* We were invoked directly, so the program might not have a
 	 PT_INTERP.  */
       _dl_rtld_libname.name = GL(dl_rtld_map).l_name;
-      /* _dl_rtld_libname.next = NULL; 	Already zero.  */
+      /* _dl_rtld_libname.next = NULL;	Already zero.  */
       GL(dl_rtld_map).l_libname =  &_dl_rtld_libname;
     }
   else
@@ -1380,6 +1384,9 @@ of this helper program; chances are you did not intend to run this program.\n\
 	      l->l_libname->name = memcpy (copy, dsoname, len);
 	    }
 
+	  /* Add the vDSO to the object list.  */
+	  _dl_add_to_namespace_list (l, LM_ID_BASE);
+
 	  /* Rearrange the list so this DSO appears after rtld_map.  */
 	  assert (l->l_next == NULL);
 	  assert (l->l_prev == main_map);