kerberos 1.5x + solaris 8 = abort on exit

Marcus Watts mdw at umich.edu
Mon Sep 11 03:16:01 EDT 2006


I found an interesting obscure problem using kerberos 1.5 with
solaris 8:

Multiple copies I built failed somewhere inside of krb5int_lib_fini
at exit time with an assertion error.  Here's a typical example:

sisyphus% /home/k5/bin/kinit mdw at CATS.UMICH.EDU
Password for mdw at CATS.UMICH.EDU: 
Assertion failed: (&(&krb5int_us_time_mutex)->os)->initialized == K5_MUTEX_DEBUG_INITIALIZED, file ../../../krb5/src/lib/krb5/krb5_libinit.c, line 87
Abort (core dumped)
sisyphus% 

It's not obvious from the above, but ...->initialized was at this point
set to K5_MUTEX_DEBUG_DESTROYED

After puzzling over this quite a bit, and trying several compilers and
debuggers (and building with --disable-thread-support) I eventually
determined that krb5int_lib_fini was being called twice.  Turns out
it's the linker's fault.  Here's what the linker was told:

/usr/ccs/bin/ld \
-z initarray=profile_library_initializer__auxinit \
-z initarray=krb5int_lib_init__auxinit \
-z finiarray=profile_library_finalizer \
-z finiarray=krb5int_lib_fini \
/opt/SUNWspro/WS6U1/lib/crti.o \
...

and here's what was in the resulting object file
(using gnu "objdump -s -T -R"):
...
Contents of section .initarray:
 24ef44 00000000 00000000                    ........
Contents of section .finiarray:
 24ef4c 00000000 00000000                    ........
...
DYNAMIC RELOCATION RECORDS
OFFSET   TYPE              VALUE
...
0024ef44 R_SPARC_32        krb5int_lib_init__auxinit
0024ef48 R_SPARC_32        krb5int_lib_init__auxinit
0024ef4c R_SPARC_32        krb5int_lib_fini
0024ef50 R_SPARC_32        krb5int_lib_fini
...

As best I can tell, ld was taking the last function name
given it, and filling the entire array with that value.
No wonder krb5int_lib_fini was being called twice.

I managed to make a "fixed" version of libkrb5.so by running ld by
hand replacing the above 4 -z's with the object made from
this assembler source:
	.section        ".initarray",#alloc,#write
	.align  4
	.word   profile_library_initializer__auxinit
	.word   krb5int_lib_init__auxinit
	.section        ".finiarray",#alloc,#write
	.align  4
	.word   profile_library_finalizer
	.word   krb5int_lib_fini

I think this probably qualifies as an "oddity".  We're rapidly retiring the
last of our solaris machines and putting very little work into them.

				-Marcus Watts
				UM ITCS UMCE



More information about the krbdev mailing list