[krbdev.mit.edu #6940] libgssapi_krb5 fails to deinitialize when unloaded

Sam Hartman via RT rt-comment at krbdev.mit.edu
Fri Jul 29 09:42:46 EDT 2011


Return-Path: <debbugs at busoni.debian.org>
Received: from localhost ([unix socket])
	by mail.suchdamage.org (Cyrus v2.2.13-Debian-2.2.13-10) with LMTPA;
	Thu, 28 Jul 2011 23:42:07 -0400
X-Sieve: CMU Sieve 2.2
Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU
	[18.9.25.12])
	by mail.suchdamage.org (Postfix) with ESMTP id 4C039203A2
	for <hartmans at suchdamage.org>; Thu, 28 Jul 2011 23:41:58 -0400 (EDT)
Received: from mailhub-dmz-2.mit.edu ( [18.7.62.37])
	by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP
	id AF.C9.02598.8FA223E4; Thu, 28 Jul 2011 23:37:28 -0400 (EDT)
Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU
	[18.9.25.13])
	by mailhub-dmz-2.mit.edu (8.13.8/8.9.2) with ESMTP id p6T3d8R9016271
	for <hartmans at mit.edu>; Thu, 28 Jul 2011 23:39:08 -0400
X-AuditID: 1209190c-b7bdeae000000a26-71-4e322af8cdee
Authentication-Results: symauth.service.identifier
Received: from busoni.debian.org (busoni.debian.org [140.211.15.34])
	by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP
	id C4.56.02582.FBA223E4; Thu, 28 Jul 2011 23:36:31 -0400 (EDT)
Received: from debbugs by busoni.debian.org with local (Exim 4.72)
	(envelope-from <debbugs at busoni.debian.org>)
	id 1Qmduj-00060d-0z; Fri, 29 Jul 2011 03:39:05 +0000
X-Loop: owner at bugs.debian.org
Subject: Bug#635847: libkrb5support0: library initialization errors in Perl
	module context
Reply-To: Russ Allbery <rra at debian.org>, 635847 at bugs.debian.org
Resent-From: Russ Allbery <rra at debian.org>
Resent-To: debian-bugs-dist at lists.debian.org
Resent-CC: Sam Hartman <hartmans at debian.org>
X-Loop: owner at bugs.debian.org
Resent-Date: Fri, 29 Jul 2011 03:39:02 +0000
Resent-Message-ID: <handler.635847.B.131191058122855 at bugs.debian.org>
X-Debian-PR-Message: report 635847
X-Debian-PR-Package: libkrb5support0
X-Debian-PR-Keywords: 
X-Debian-PR-Source: krb5
Received: via spool by submit at bugs.debian.org id=B.131191058122855
	(code B ref -1); Fri, 29 Jul 2011 03:39:02 +0000
Received: (at submit) by bugs.debian.org; 29 Jul 2011 03:36:21 +0000
X-Spam-Checker-Version: SpamAssassin 3.3.1-bugs.debian.org_2005_01_02
	(2010-03-16) on busoni.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-13.8 required=4.0 tests=BAYES_00,FOURLA,
	FROMDEVELOPER, HAS_PACKAGE, RCVD_IN_DNSWL_MED,
	XMAILER_REPORTBUG autolearn=ham
	version=3.3.1-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 24; hammy, 151; neutral, 186; spammy,
	0. spammytokens: hammytokens:0.000-+--H*M:reportbug,
	0.000-+--H*MI:reportbug, 
	0.000-+--H*x:reportbug, 0.000-+--H*UA:reportbug, 0.000-+--H*x:5.1.1
Received: from smtp3.stanford.edu ([171.67.219.83] helo=smtp.stanford.edu)
	by busoni.debian.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.72) (envelope-from <rra at debian.org>) id 1Qmds5-0005wA-28
	for submit at bugs.debian.org; Fri, 29 Jul 2011 03:36:21 +0000
Received: from smtp.stanford.edu (localhost.localdomain [127.0.0.1])
	by localhost (Postfix) with SMTP id 819C1D83A1;
	Thu, 28 Jul 2011 20:36:14 -0700 (PDT)
Received: from windlord.stanford.edu (windlord.Stanford.EDU [171.67.225.134])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.stanford.edu (Postfix) with ESMTPS id 18525D839F;
	Thu, 28 Jul 2011 20:36:12 -0700 (PDT)
Received: by windlord.stanford.edu (Postfix, from userid 1000)
	id 43B959F781; Thu, 28 Jul 2011 20:36:12 -0700 (PDT)
From: Russ Allbery <rra at debian.org>
To: Debian Bug Tracking System <submit at bugs.debian.org>
Message-ID: <20110729033612.587.44672.reportbug at windlord.stanford.edu>
X-Mailer: reportbug 5.1.1
Date: Thu, 28 Jul 2011 20:36:12 -0700
Delivered-To: submit at bugs.debian.org
Resent-Sender: Debian BTS <debbugs at busoni.debian.org>
X-Brightmail-Tracker: H4sIAAAAAAAAA11SW0gUYRTmn1l3R9nZxvF2XBJh6UKra7pI+RCbDxVGIWFPiZCTO7kbe5Ed
	FfVBRNNKe7BMUzETzUtKeCO3tCW0Fre00Iw0KQlSsi0zNUFTqxnHtejt+875zvedA4fA6Qap
	kjBa0lmbhTGppD4SWqbbrVlRa+MjKxzKmOWiD9JYFHe3fEh2CiX6HNKzJmMma9uvS/YxjFZ2
	4Gk/lVmlc914HqoPKEbeBFDRMP+uBxdxIIxMtUuLkQ9BUw4Ea78XvEQyicA53oo8E5VtN6QC
	RpQW+l66t0QvELib1zGRNCNwLQ1KihHBT4TA8NscYcCPSoT7w6ubRjR1GOqruzBBQlNqcPRa
	xXI43F79hjx4sfuK138uQnmsohMX8VHoXS+RiaupoLbsi0yU74LlO7TnLnveXamIAZw1U5g4
	mgv5l6e3ko5A48zqVpIRXE1holwBo7MrmzcB1Yfg6dAsEslHBI6Ja1un38RgrcYlEUktgkdv
	lpBIyjBoH3fJxIwM2Kj+sZmN8yfU9S1KS5G6+h8qYJLyhWdV0xKxHgr2uRq8DuGtKERvztGY
	GaOJY1M0XApjsbA2TVSE2ZgeweozupDwDN7B8gfoa79qAFEEUslJ37SoeNqLyeSyzQMomMBU
	AeTkXm08rThn1WcbGM5w1pZhYrkBBASu8if1Dbyc1DPZOazN6mlpCIJaKKqUUvbl6T6klFis
	FlYFpJ3/OdrXxqayWeeNJv4hPXqM8Bb85LzfpKAhuTTGzBlTxf5z3m+q4okT0ZtGyiByQxBR
	gsiQYdn28fy2GwXxl/iRdBivkvOfv+3k5kMwPsRLISzNpTN/W8o8pD0eXpvb6WypOAZBCt9b
	MUOVuh2203pt8ExSwsVhuzulK2zUP4UrzL2kS3Xau0eSJj+pjWMHru4p6fnV8TA5el19fcXK
	NWETn9tCW07GJuTfKy9rXzqRZthZ8F53pur1/GP/gwVkP2t6VdjjUHyPxC7E7RsMDO0xaErk
	je1dDSoJZ2Ci1LiNY/4A/y34dLYDAAA=
X-DSPAM-Result: Whitelisted
X-DSPAM-Processed: Thu Jul 28 23:42:07 2011
X-DSPAM-Confidence: 0.9938
X-DSPAM-Probability: 0.0000
X-DSPAM-Signature: 8042,4e322c0f19271929019014
X-DSPAM-Factors: 27, From*Russ Allbery <rra at debian.org>, 0.00010,
	dfsg, 0.00051, debconf, 0.00051, krb5, 0.00192, krb5, 0.00192,
	Received*spool, 0.00345, goes+away, 0.00612,
	Received*localhost+(Postfix), 0.00726,
	Received*submit+bugs.debian.org, 0.00764,
	Received*submit+bugs.debian.org, 0.00764,
	Resent-Sender*<debbugs, 0.00764, ldap, 0.00764,
	Received*debbugs, 0.00764, Received*from+debbugs, 0.00764,
	Received*spool+by, 0.00764,
	X-Spam-Bayes*spammytokens, 0.00764,
	Received*bugs.debian.org, 0.00764,
	Received*bugs.debian.org, 0.00764, Received*(code+B, 0.00764,
	Resent-Sender*BTS, 0.00764, X-Loop*owner, 0.00764,
	X-Loop*owner, 0.00764, Received*via+spool, 0.00764,
	Resent-Sender*Debian+BTS, 0.00764, Received*B+ref, 0.00764,
	Received*debbugs+by, 0.00764, Resent-To*dist, 0.00764
MIME-Version: 1.0

Package: libkrb5support0
Version: 1.9.1+dfsg-1
Severity: normal

I'm not sure that this bug is in the Kerberos library side, but I'll
start here and we can reassign if the problem is somewhere else.

If you run the following Perl script (with libnet-ldap-perl,
libauthen-sasl-cyrus-perl, and libauthen-krb5-perl installed along
with the MIT Kerberos Cyrus SASL GSSAPI module package installed):

#!/usr/bin/perl
use Net::LDAP;
use Authen::SASL qw(Cyrus);
use Authen::Krb5;

sub dir_bind {
   my ($serverName) = @_;

   print "Creating LDAP object for $serverName\n";
   my $ld = Net::LDAP->new($serverName);
   my $mech = 'GSSAPI';
   my $sasl = Authen::SASL->new(mechanism => $mech);

   print "binding using $mech\n";
   $ld->bind("", sasl=>$sasl);

   $ld->unbind if $ld;
}

dir_bind('ldap1.stanford.edu');
dir_bind('ldap2.stanford.edu');
exit;

you get:

Creating LDAP object for ldap1.stanford.edu
binding using GSSAPI
Creating LDAP object for ldap2.stanford.edu
binding using GSSAPI
perl: ../../../src/util/support/threads.c:351: krb5int_key_register: Assertion `destructors_set[keynum] == 0' failed.
Abort

All of the following must be true to trigger this:

1. Creating and using two separate Authen::SASL objects.  Just creating
   one will not trigger this bug.

2. Loading Authen::Krb5 (note that it's not used).  If it's not loaded,
   this won't be a problem.

3. Not loading any other module that loads libgssapi_krb5 into Perl's
   context.  If you add "use Net::Remctl;" to the script, the assertion
   goes away; similarly for Authen::Krb5::Admin, or anything else that
   loads the GSSAPI library.

My theory of what's happening here:

1. Authen::Krb5 loads libkrb5support but not libgssapi_krb5.

2. Cyrus loads the GSSAPI module when the SASL object is created and
   used, which loads libgssapi_krb5 and initializes it.

3. Cyrus unloads the GSSAPI module when the Authen::SASL object goes
   out of scope, which then unloads libgssapi_krb5, but something
   doesn't work properly about cleaning up the library initialization.
   libkrb5support is not unloaded and hangs on to that library
   initialization data.  (If Authen::Krb5 weren't loaded, it wouldn't
   stay loaded, and this problem then doesn't occur.)

4. When Cyrus loads the GSSAPI module again, it reloads libgssapi_krb5,
   which tries to initialize itself again.  Since libkrb5support thinks
   it's already initialized, it asserts.

Assuming this theory is correct, the question is why, when libgssai_krb5
is unloaded, it isn't cleaning up its initialization properly.

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.39-2-686-pae (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libkrb5support0 depends on:
ii  libc6                         2.13-10    Embedded GNU C Library: Shared lib
ii  libkeyutils1                  1.4-6      Linux Key Management Utilities (li

libkrb5support0 recommends no packages.

Versions of packages libkrb5support0 suggests:
pn  krb5-doc                      <none>     (no description available)
pn  krb5-user                     <none>     (no description available)

-- no debconf information







More information about the krb5-bugs mailing list