svn commit: r184497 - stable/7/libexec/rtld-elf

David Xu davidxu at FreeBSD.org
Fri Oct 31 02:09:23 PDT 2008


Author: davidxu
Date: Fri Oct 31 09:09:22 2008
New Revision: 184497
URL: http://svn.freebsd.org/changeset/base/184497

Log:
  Merge revision 183061 from head to stable/7.
  
  > Allow multiple locks to be acquired by detecting corresponding
  > bit flag, otherwise if a thread acquired a lock, another thread
  > or the current thread itself can no longer acquire another lock
  > because thread_mask_set() return whole flag word, this results
  > bit leaking in the word and misbehavior in later locking and
  > unlocking.
  
  Approved by:	re (kib)

Modified:
  stable/7/libexec/rtld-elf/   (props changed)
  stable/7/libexec/rtld-elf/rtld_lock.c

Modified: stable/7/libexec/rtld-elf/rtld_lock.c
==============================================================================
--- stable/7/libexec/rtld-elf/rtld_lock.c	Fri Oct 31 08:42:34 2008	(r184496)
+++ stable/7/libexec/rtld-elf/rtld_lock.c	Fri Oct 31 09:09:22 2008	(r184497)
@@ -184,7 +184,7 @@ rtld_lock_t	rtld_phdr_lock = &rtld_locks
 int
 rlock_acquire(rtld_lock_t lock)
 {
-	if (thread_mask_set(lock->mask)) {
+	if (thread_mask_set(lock->mask) & lock->mask) {
 	    dbg("rlock_acquire: recursed");
 	    return (0);
 	}
@@ -195,7 +195,7 @@ rlock_acquire(rtld_lock_t lock)
 int
 wlock_acquire(rtld_lock_t lock)
 {
-	if (thread_mask_set(lock->mask)) {
+	if (thread_mask_set(lock->mask) & lock->mask) {
 	    dbg("wlock_acquire: recursed");
 	    return (0);
 	}


More information about the svn-src-all mailing list