]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Work around glibc bug 11941 (dlclose assertion) 992/head
authorGreg Hudson <ghudson@mit.edu>
Wed, 23 Oct 2019 04:48:25 +0000 (00:48 -0400)
committerGreg Hudson <ghudson@mit.edu>
Wed, 23 Oct 2019 15:51:35 +0000 (11:51 -0400)
When building against glibc 2.24 or earlier, suppress calls to
dlclose() to prevent the assertion failure "_dl_close: Assertion
`map->l_init_called' failed" at process exit.  We need this workaround
to enable automated tests that load GSSAPI modules.

ticket: 7135

src/util/support/plugins.c

index 47368be9d49be24250272b91147c64a343021949..3329db7dc3b4985bf4d4ab326265b36c65a21a6d 100644 (file)
 #define PLUGIN_DLOPEN_FLAGS (RTLD_NOW | RTLD_LOCAL | GROUP | NODELETE)
 #endif
 
+/*
+ * glibc bug 11941, fixed in release 2.25, can cause an assertion failure in
+ * dlclose() on process exit.  Our workaround is to leak dlopen() handles
+ * (which doesn't typically manifest in leak detection tools because the
+ * handles are still reachable via a global table in libdl).  Because we
+ * dlopen() with RTLD_NODELETE, we weren't going to unload the plugin objects
+ * anyway.
+ */
+#ifdef __linux__
+#include <features.h>
+#if ! __GLIBC_PREREQ(2, 25)
+#define dlclose(x)
+#endif
+#endif
+
 #if USE_DLOPEN && USE_CFBUNDLE
 #include <CoreFoundation/CoreFoundation.h>