From: Ulrich Drepper Date: Thu, 10 Mar 2011 17:51:33 +0000 (+0100) Subject: Fix copy relocations handling of unique objects. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=411a9d6b1de462394aabd2a5bf920fde140249ff;p=thirdparty%2Fglibc.git Fix copy relocations handling of unique objects. (cherry picked from commit 028478fa40d85a73b19638dbe3f83b1acebf370c) --- diff --git a/ChangeLog b/ChangeLog index c97afec487c..850d3007132 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-03-10 Ulrich Drepper + + [BZ #12510] + * elf/dl-lookup.c (do_lookup_x): For copy relocations of unique objects + copy from the symbol referenced in the relocation to initialize the + used variable. + Patch by Piotr Bury . + 2011-03-06 Ulrich Drepper * elf/dl-load.c (_dl_map_object): If we are looking for the first diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c index 763ec16fa43..0a7b94b2eeb 100644 --- a/elf/dl-lookup.c +++ b/elf/dl-lookup.c @@ -1,5 +1,5 @@ /* Look up a symbol in the loaded objects. - Copyright (C) 1995-2005, 2006, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1995-2007, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -363,8 +363,19 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash, if (entries[idx].hashval == new_hash && strcmp (entries[idx].name, undef_name) == 0) { - result->s = entries[idx].sym; - result->m = (struct link_map *) entries[idx].map; + if ((type_class & ELF_RTYPE_CLASS_COPY) != 0) + { + /* We possibly have to initialize the central + copy from the copy addressed through the + relocation. */ + result->s = sym; + result->m = (struct link_map *) map; + } + else + { + result->s = entries[idx].sym; + result->m = (struct link_map *) entries[idx].map; + } __rtld_lock_unlock_recursive (tab->lock); return 1; }