RT RT/krbdev.mit.edu: Ticket #3293 use more caution in testing for pthread_mutex_lock Signed in as guest.
[Logout]

[Home] [Search] [Configuration]

[Display] [History] [Basics] [Dates] [People] [Links] [Jumbo]

 
 

 The Basics  
Id
3293
Status
resolved
Worked
0 min
Priority
0/0
Queue
krb5
 

 Keyword Selections  
Component
  • krb5-libs
Version_reported
  • 1.4.3
Version_Fixed
  • 1.4.4
Target_Version
  • 1.4.4
Tags
  • pullup
 

 Relationships  
Depends on:
Depended on by:
Parents:
Children:

Refers to:
Referred to by:
 
 Dates  
Created: Fri Dec 16 19:10:37 2005
Starts: Not set
Started: Not set
Last Contact: Wed Mar 8 17:17:35 2006
Due: Not set
Updated: Wed Mar 8 17:17:35 2006 by tlyu
 

 People  
Owner
 raeburn
Requestors
 raeburn@mit.edu
Cc
 
AdminCc
 
 

 More about Ken Raeburn  
Comments about this user:
No comment entered about this user
This user's 25 highest priority tickets:
 

History   Display mode: [Brief headers] [Full headers]
      Fri Dec 16 19:10:40 2005  raeburn - Ticket created    
     
Subject: use more caution in testing for pthread_mutex_lock

From a recent bug report on kerberos@mit from Jon DeVree, with some help
in the analysis from Russ Allbery and Sam:

On Linux (GNU libc and friends), if nsswitch.conf enables ldap lookups
for "passwd", and if libnss_ldap pulls in the pthread library (as it
does in Debian "unstable" at the moment), kinit can hang trying to lock
a mutex after the password has been entered, in certain circumstances.

The problem:

Our current thread support tests to see if pthread_mutex_lock is defined
in the C library, and if it is, turns off the run-time weak-reference
test we used to do.  I think we used to test just the address of
pthread_mutex_lock, so turning off that test made sense; we do more
thorough tests now.

GNU libc has stub definitions for the pthread_mutex_* functions, so we
can call pthread_mutex_init in the C library.  Then when we look up the
name for the current uid via getpwuid (which uses nsswitch, which loads
libnss_ldap) the pthread library gets loaded.  Then we call
pthread_mutex_lock from libpthread, which doesn't seem to like the
initialization done by the C library stub.  While it can certainly be
argued that this combination of effects is a GNU libc (or ldap library)
bug, we should work around it.

Simple fix: Define USE_PTHREAD_LOCK_ONLY_IF_LOADED on all systems
supporting weak references, even if libc appears to have
pthread_mutex_lock (and even if it's the real thing, and compatible with
the thread library, unless we can identify either the working or failing
systems).

Slightly more complicated fix: USE_PTHREAD_LOCK_ONLY_IF_LOADED and
HAVE_PRAGMA_WEAK_REF are each used in different places to decide whether
to do the run-time test or the unconditional call.  We should have only
one macro for this, and probably not make it explicitly dependent on the
#pragma implementation.


Download (untitled) 1.7k
      Fri Dec 16 22:34:58 2005  raeburn - Correspondence added    
     
From: raeburn@mit.edu
Subject: CVS Commit

* k5-thread.h (USE_PTHREAD_LOCK_ONLY_IF_LOADED): Define any time
HAVE_PRAGMA_WEAK_REF is defined.

Commit By: raeburn



Revision: 17563
Changed Files:
U   trunk/src/include/ChangeLog
U   trunk/src/include/k5-thread.h


Download (untitled) 218b
      Wed Dec 21 20:19:38 2005  raeburn - Tags pullup added    
      Wed Mar  8 17:17:31 2006  tlyu - Status changed from open to resolved    
      Wed Mar  8 17:17:32 2006  tlyu - Version_Fixed 1.4.4 added    
      Wed Mar  8 17:17:32 2006  tlyu - Correspondence added    
     
From: tlyu@mit.edu
Subject: CVS Commit

pull up r17563 from trunk

Commit By: tlyu



Revision: 17717
Changed Files:
U   branches/krb5-1-4/src/include/ChangeLog
U   branches/krb5-1-4/src/include/k5-thread.h


Download (untitled) 167b