submitted-dlopen-noload
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Sat, 26 Aug 2017 09:09:24 +0000 (10:09 +0100)
committerAurelien Jarno <aurel32@debian.org>
Sat, 26 Aug 2017 09:09:24 +0000 (10:09 +0100)
2016-03-12  Aurelien Jarno  <aurelien@aurel32.net>

[BZ #19810]
* elf/dl-open.c (dl_open_worker): Set DF_1_NODELETE flag later.

Gbp-Pq: Topic any
Gbp-Pq: Name submitted-dlopen-noload.diff

elf/dl-open.c

index 55ed8159ebd681579d57cc9fa6612334f64af478..67154e80469d2466bb99560295e69290faeae986 100644 (file)
@@ -237,12 +237,6 @@ dl_open_worker (void *a)
   args->map = new = _dl_map_object (call_map, file, lt_loaded, 0,
                                    mode | __RTLD_CALLMAP, args->nsid);
 
-  /* Mark the object as not deletable if the RTLD_NODELETE flags was passed.
-     Do this early so that we don't skip marking the object if it was
-     already loaded.  */
-  if (__glibc_unlikely (mode & RTLD_NODELETE))
-    new->l_flags_1 |= DF_1_NODELETE;
-
   /* If the pointer returned is NULL this means the RTLD_NOLOAD flag is
      set and the object is not already loaded.  */
   if (new == NULL)
@@ -251,6 +245,12 @@ dl_open_worker (void *a)
       return;
     }
 
+  /* Mark the object as not deletable if the RTLD_NODELETE flags was passed.
+     Do this early so that we don't skip marking the object if it was
+     already loaded.  */
+  if (__glibc_unlikely (mode & RTLD_NODELETE))
+    new->l_flags_1 |= DF_1_NODELETE;
+
   if (__glibc_unlikely (mode & __RTLD_SPROF))
     /* This happens only if we load a DSO for 'sprof'.  */
     return;