mirror of
https://github.com/ceph/ceph
synced 2025-02-23 02:57:21 +00:00
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>
This commit is contained in:
parent
d9497684f7
commit
78d301098f
@ -75,9 +75,11 @@ public:
|
||||
}
|
||||
}
|
||||
~DencoderPlugin() {
|
||||
#if !defined(__FreeBSD__)
|
||||
if (mod) {
|
||||
dlclose(mod);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
int register_dencoders() {
|
||||
assert(mod);
|
||||
|
Loading…
Reference in New Issue
Block a user