d8307d
commit e37c2cf299b61ce18f62852f6c5624c27829b610
d8307d
Author: Florian Weimer <fweimer@redhat.com>
d8307d
Date:   Thu Oct 31 18:48:43 2019 +0100
d8307d
d8307d
    Move _dl_open_check to its original place in dl_open_worker
d8307d
    
d8307d
    This reverts the non-test change from commit d0093c5cefb7f7a4143f
d8307d
    ("Call _dl_open_check after relocation [BZ #24259]"), given that
d8307d
    the underlying bug has been fixed properly in commit 61b74477fa7f63
d8307d
    ("Remove all loaded objects if dlopen fails, ignoring NODELETE
d8307d
    [BZ #20839]").
d8307d
    
d8307d
    Tested on x86-64-linux-gnu, with and without --enable-cet.
d8307d
    
d8307d
    Change-Id: I995a6cfb89f25d2b0cf5e606428c2a93eb48fc33
d8307d
d8307d
diff --git a/elf/dl-open.c b/elf/dl-open.c
d8307d
index 25838b073ac1edaf..e13968d4d7c4c83f 100644
d8307d
--- a/elf/dl-open.c
d8307d
+++ b/elf/dl-open.c
d8307d
@@ -619,6 +619,8 @@ dl_open_worker (void *a)
d8307d
   _dl_debug_state ();
d8307d
   LIBC_PROBE (map_complete, 3, args->nsid, r, new);
d8307d
 
d8307d
+  _dl_open_check (new);
d8307d
+
d8307d
   /* Print scope information.  */
d8307d
   if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
d8307d
     _dl_show_scope (new, 0);
d8307d
@@ -699,12 +701,6 @@ dl_open_worker (void *a)
d8307d
 	_dl_relocate_object (l, l->l_scope, reloc_mode, 0);
d8307d
     }
d8307d
 
d8307d
-  /* NB: Workaround for [BZ #20839] which doesn't remove the NODELETE
d8307d
-     object when _dl_open_check throws an exception.  Move it after
d8307d
-     relocation to avoid leaving the NODELETE object mapped without
d8307d
-     relocation.  */
d8307d
-  _dl_open_check (new);
d8307d
-
d8307d
   /* This only performs the memory allocations.  The actual update of
d8307d
      the scopes happens below, after failure is impossible.  */
d8307d
   resize_scopes (new);