mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
* sysdeps/generic/ldsodefs.h (DL_LOOKUP_GSCOPE_LOCK): New definition.
* elf/dl-runtime.c (_dl_fixup, _dl_profile_fixup): Or in DL_LOOKUP_GSCOPE_LOCK into flags after THREAD_GSCOPE_SET_FLAG (). * elf/dl-sym.c (do_sym): Likewise. * include/link.h (struct link_map): Add l_serial field. * elf/dl-object.c (_dl_new_object): Initialize l_serial. * elf/dl-lookup.c (add_dependency): Add flags argument. Remember map->l_serial, if DL_LOOKUP_GSCOPE_LOCK is among flags, use THREAD_GSCOPE_RESET_FLAG before and THREAD_GSCOPE_SET_FLAG after __rtld_lock_lock_recursive (GL(dl_load_lock)) to avoid deadlock. Don't dereference map until it has been found on some list. If map->l_serial changed, return -1.
This commit is contained in:
@ -100,7 +100,10 @@ _dl_fixup (
|
||||
we are not using any threads (yet). */
|
||||
int flags = DL_LOOKUP_ADD_DEPENDENCY;
|
||||
if (!RTLD_SINGLE_THREAD_P)
|
||||
THREAD_GSCOPE_SET_FLAG ();
|
||||
{
|
||||
THREAD_GSCOPE_SET_FLAG ();
|
||||
flags |= DL_LOOKUP_GSCOPE_LOCK;
|
||||
}
|
||||
|
||||
result = _dl_lookup_symbol_x (strtab + sym->st_name, l, &sym, l->l_scope,
|
||||
version, ELF_RTYPE_CLASS_PLT, flags, NULL);
|
||||
@ -192,7 +195,10 @@ _dl_profile_fixup (
|
||||
we are not using any threads (yet). */
|
||||
int flags = DL_LOOKUP_ADD_DEPENDENCY;
|
||||
if (!RTLD_SINGLE_THREAD_P)
|
||||
THREAD_GSCOPE_SET_FLAG ();
|
||||
{
|
||||
THREAD_GSCOPE_SET_FLAG ();
|
||||
flags |= DL_LOOKUP_GSCOPE_LOCK;
|
||||
}
|
||||
|
||||
result = _dl_lookup_symbol_x (strtab + refsym->st_name, l,
|
||||
&defsym, l->l_scope, version,
|
||||
|
Reference in New Issue
Block a user