about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2023-10-18 11:30:38 +0200
committerFlorian Weimer <fweimer@redhat.com>2023-10-18 11:30:38 +0200
commitdd32e1db386c77c61850a7cbd0c126b7b3c63ece (patch)
tree9f0c9c3ead1a6be1c63b6841c85ec5597bf10f6a /sysdeps
parent2ad9b674cf6cd6ba59c064427cb7aeb43a66d8a9 (diff)
downloadglibc-dd32e1db386c77c61850a7cbd0c126b7b3c63ece.tar.gz
glibc-dd32e1db386c77c61850a7cbd0c126b7b3c63ece.tar.xz
glibc-dd32e1db386c77c61850a7cbd0c126b7b3c63ece.zip
Revert "elf: Always call destructors in reverse constructor order (bug 30785)"
This reverts commit 6985865bc3ad5b23147ee73466583dd7fdf65892.

Reason for revert:

The commit changes the order of ELF destructor calls too much relative
to what applications expect or can handle.  In particular, during
process exit and _dl_fini, after the revert commit, we no longer call
the destructors of the main program first; that only happens after
some dlopen'ed objects have been destructed.  This robs applications
of an opportunity to influence destructor order by calling dlclose
explicitly from the main program's ELF destructors.  A couple of
different approaches involving reverse constructor order were tried,
and none of them worked really well.  It seems we need to keep the
dependency sorting in _dl_fini.

There is also an ambiguity regarding nested dlopen calls from ELF
constructors: Should those destructors run before or after the object
that called dlopen?  Commit 6985865bc3ad5b2314 used reverse order
of the start of ELF constructor calls for destructors, but arguably
using completion of constructors is more correct.  However, that alone
is not sufficient to address application compatibility issues (it
does not change _dl_fini ordering at all).
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/ldsodefs.h4
1 files changed, 0 insertions, 4 deletions
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 82c5383c7e..9b50ddd09f 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -1037,10 +1037,6 @@ extern int _dl_check_map_versions (struct link_map *map, int verbose,
 extern void _dl_init (struct link_map *main_map, int argc, char **argv,
 		      char **env) attribute_hidden;
 
-/* List of ELF objects in reverse order of their constructor
-   invocation.  */
-extern struct link_map *_dl_init_called_list attribute_hidden;
-
 /* Call the finalizer functions of all shared objects whose
    initializer functions have completed.  */
 extern void _dl_fini (void) attribute_hidden;