This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.10-216-g09cd1f5


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  09cd1f575476a48b262e4e45997bb56753f9d4f5 (commit)
      from  009a69f0bcce04d3743c9b59246e6885dbd2b100 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=09cd1f575476a48b262e4e45997bb56753f9d4f5

commit 09cd1f575476a48b262e4e45997bb56753f9d4f5
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Jul 27 07:25:57 2009 -0700

    Fix STB_GNU_UNIQUE handling for > 30 unique symbols.
    
    There were several issues when the initial 31 entries hashtab filled up.
    size * 3 <= tab->n_elements is always false, table can't have more elements
    than its size.  I assume from libiberty/hashtab.c this meant to be check for
    3/4 full.  Even after fixing that, _dl_higher_prime_number (31) apparently
    returns 31, only _dl_higher_prime_number (32) returns 61.  And, size
    variable wasn't updated during reallocation, which means during reallocation
    the insertion of the new entry was done into a wrong spot.
    
    All this lead to a hang in ld.so, because a search with n_elements 31 size
    31 wouldn't ever terminate.

diff --git a/ChangeLog b/ChangeLog
index 801ec18..8cc2e67 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-07-27  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf/dl-lookup.c (do_lookup_x): Fix check for table more than
+	3/4 full.  Pass size + 1 rather than size to _dl_higher_prime_number.
+	Update size when reallocating.
+
 2009-07-26  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/x86_64/tst-xmmymm.sh: New file.  Check whether any of the
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 18f7288..1d68d67 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -377,10 +377,10 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
 			idx -= size;
 		    }
 
-		  if (size * 3 <= tab->n_elements)
+		  if (size * 3 <= tab->n_elements * 4)
 		    {
 		      /* Expand the table.  */
-		      size_t newsize = _dl_higher_prime_number (size);
+		      size_t newsize = _dl_higher_prime_number (size + 1);
 		      struct unique_sym *newentries
 			= calloc (sizeof (struct unique_sym), newsize);
 		      if (newentries == NULL)
@@ -398,6 +398,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
 
 		      tab->free (entries);
 		      tab->size = newsize;
+		      size = newsize;
 		      entries = tab->entries = newentries;
 		      tab->free = free;
 		    }

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog       |    6 ++++++
 elf/dl-lookup.c |    5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]