[PATCH 0/2] Predictable ELF destructor ordering

Florian Weimer fweimer@redhat.com
Tue Dec 14 21:01:57 GMT 2021


These patches remove the dependency sorting from dlclose and process
shutdown, so that destructor order is the reverse of constructor order
in more cases (always if the process does not call dlclose).

Tested on i686-linux-gnu and x86_64-linux-gnu.

I would like to include this in glibc 2.35 if possible, among the other
dependency sorting changes.

I believe this fixes bugs 15311 and 15903.

Florian Weimer (2):
  elf: Do not rely on relocation dependencies for destructor sorting
  elf: Always call destructors in reverse constructor order

 elf/dl-close.c             | 130 +++++++++++++---------
 elf/dl-deps.c              |   3 +-
 elf/dl-fini.c              | 216 ++++++++++++++-----------------------
 elf/dl-init.c              |  14 +++
 elf/dl-sort-maps.c         | 105 ++----------------
 elf/dso-sort-tests-1.def   |   6 +-
 include/link.h             |   4 +
 sysdeps/generic/ldsodefs.h |   6 +-
 8 files changed, 194 insertions(+), 290 deletions(-)


base-commit: 0884724a95b60452ad483dbe086d237d02ba624d
-- 
2.33.1



More information about the Libc-alpha mailing list