Assertion Error in MIT Kerberos 1.12.4

Greg Hudson ghudson at mit.edu
Wed Jan 20 18:47:04 EST 2016


On 01/20/2016 02:38 PM, Vipul Mehta wrote:
> In my setup, libkrb5.so.3 and libgssapi_krb5.so.2 are same as libkrb5.so
> and libgssapi_krb5.so respectively.

Are they symlinks or copies of the same file?  I believe it's normal to
use symlinks.

> Now when i use "libkrb5.so" and "libgssapi_krb5.so" library names for
> dynamic loading, it crashes with following assertion error :
> "thread.c:347: krb5int_key_register" Assertion failed:
> destructors_set[keynum] == 0 failed."
> 
> My utility works fine if I use "libkrb5.so.3" and "libgssapi_krb5.so.2"
> library names for dynamic loading.

It sounds like in the failing case you are loading libkrb5 and
libgssapi_krb5 twice each, by using different sonames.  In the
successful case, ldopen() returns handles to the already loaded
libraries.  In both cases, libkrb5support (which manages the
destructors_set table) is only loaded once.

> I debugged and found that k5_key_register() was being called twice for
> key_value = 1 in the first case in which it failed.
> 
> What is this key registration  ? Is it part of library initialization
> routine ? When it is supposed to be called ?

I didn't write this code, but my understanding is that it is designed
with the assumption that OS thread-specific data keys are precious, and
therefore krb5 should use just one thread-specific data key, whose value
is an array of the thread-specific data units we need.
k5_key_register() registers the destructor for an internal
thread-specific data index.  If the process has two copies of a library
hitting the same libkrb5support destructors table, then we can't easily
keep track of which destructor function pointer is still valid to call.


More information about the krbdev mailing list