Skip to content

Commit

Permalink
Work around glibc bug 11941 (dlclose assertion)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
greghudson committed Oct 23, 2019
1 parent d66b311 commit bf5953c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/util/support/plugins.c
Expand Up @@ -54,6 +54,21 @@
#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)

This comment has been minimized.

Copy link
@TBK

TBK Feb 26, 2020

Contributor

With this change krb5 v1.18 can not be build against musl libc without patching.

gcc -fPIC -DSHARED -DHAVE_CONFIG_H  -I../../include -I../../include  -DKRB5_DEPRECATED=1 -DKRB5_PRIVATE -Os -fomit-frame-pointer -fPIC -I/usr/include/et -Os -fomit-frame-pointer  -pthread  -c utf8_conv.c -o utf8_conv.so.o && mv -f utf8_conv.so.o utf8_conv.so
plugins.c:67:20: error: missing binary operator before token "("
   67 | #if !__GLIBC_PREREQ(2, 25)
      |                    ^
gcc -fPIC -DSHARED -DHAVE_CONFIG_H  -I../../include -I../../include  -DKRB5_DEPRECATED=1 -DKRB5_PRIVATE -Os -fomit-frame-pointer -fPIC -I/usr/include/et -Os -fomit-frame-pointer  -pthread  -c zap.c -o zap.so.o && mv -f zap.so.o zap.so

This comment has been minimized.

Copy link
@nh2

nh2 Mar 31, 2020

Thanks for finding this!

This comment has been minimized.

Copy link
@nh2

nh2 Mar 31, 2020

The fixes for that seem to be:

This comment has been minimized.

Copy link
@AndreRH

AndreRH Apr 10, 2020

I also hope that lands in a release soon

This comment has been minimized.

Copy link
@AndreRH

AndreRH Apr 10, 2020

Easily reproducable with buildroot:
git clone git://git.buildroot.net/buildroot
cd buildroot
echo "BR2_PACKAGE_LIBKRB5=y" > libkrb5.snippet
rm package/libkrb5/libkrb5.hash # only contains old hash, so don't use it
#now change version in package/libkrb5/libkrb5.mk to desired version, e.g. 1.18 and run:
./utils/test-pkg -c libkrb5.snippet -d libkrb5 -p libkrb5

This comment has been minimized.

Copy link
@AndreRH

AndreRH Apr 13, 2020

thx for the release, looks good

#define dlclose(x)
#endif
#endif

#if USE_DLOPEN && USE_CFBUNDLE
#include <CoreFoundation/CoreFoundation.h>

Expand Down

0 comments on commit bf5953c

Please sign in to comment.