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