libdl: first execute all destructors, then munmap library
commit14be0795f4ad0ec7c689cfdf9e891bce24241999
authorWaldemar Brodkorb <wbx@uclibc-ng.org>
Fri, 27 Apr 2018 05:00:54 +0000 (27 06:00 +0100)
committerWaldemar Brodkorb <wbx@uclibc-ng.org>
Fri, 27 Apr 2018 21:47:05 +0000 (27 22:47 +0100)
tree8780cb224dfd993f5e83a7cd80bfefd0dcdb551e
parent132decd2a043d0ccf799f42bf89f3ae0c11e95d5
libdl: first execute all destructors, then munmap library

Fix problem which might exist since 2011. We need to execute
the destructors for all dependant libraries, before munmap the
shared libraries, otherwise running destructor of a dependent library
might cause a segfault, trying to access an already unmapped memory.

This fixes for example segfaults while running php -m with ldap
module.

Reported-By: Dave Flogeras <dflogeras2@gmail.com>
Tested-By: Dave Flogeras <dflogeras2@gmail.com>
ldso/libdl/libdl.c