]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
tools: do not unload plugins during destruction.
authorWillem Jan Withagen <wjw@digiware.nl>
Sun, 11 Apr 2021 13:01:22 +0000 (15:01 +0200)
committerKefu Chai <tchaikov@gmail.com>
Thu, 1 Sep 2022 17:08:25 +0000 (01:08 +0800)
commit982342a80e8ba6249fba60d6483089aa9fe51390
tree24d35f89a52cd8ae19d92424289952763807bdc3
parent230be0fc97128c8ecbcbcec51e8a80ec5e5ec7b5
tools: do not unload plugins during destruction.

FreeBSD ceph-dencoder crashes in the exit() calls, due to
invalid pointer references during the release process of
the loaded libraries.

Often this is signaled by libc reporting:
  __cxa_thread_call_dtors: dtr 0x47efc0 from unloaded dso, skipping

The cause for this is different behaviour between FreeBSD and Linux:
https://groups.google.com/g/bsdmailinglist/c/22ncTZAbDp4/m/Dii_pII5AwAJ
_The FreeBSD implementation here looks racy. If one thread dlcloses an
object while another thread is exiting, we can end up calling a
function at an invalid memory address. It also looks as if it may
be possible to unload one library, load another at the same address,
and end up executing entirely the wrong code, which would have some
serious security implications.

The GNU/Linux equivalent of this function locks the DSO in memory
until all references to it have gone away. A call to dlclose() on
GNU/Linux will not actually unload the library until all threads
with destructors in that library have been unloaded. I believe
that this reuses the same reference counting mechanism that
allows the same library to be dlopened and dlclosed multiple times.

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
(cherry picked from commit 78d301098f6ead7fc341b68d7ac5e0a1cd3295c5)
src/tools/ceph-dencoder/ceph_dencoder.cc