diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-02-21 01:06:02 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-02-21 01:06:02 +0000 |
commit | a461b14777bc56a19d3252d7fa5b47ee598757a0 (patch) | |
tree | cd4ec84558ed8db4b6a0af36d57f56328ee686ce /dlfcn | |
parent | 5990e1fe120708a10ae8ab0caf4a284b5d6b10f8 (diff) | |
download | glibc-a461b14777bc56a19d3252d7fa5b47ee598757a0.tar glibc-a461b14777bc56a19d3252d7fa5b47ee598757a0.tar.gz glibc-a461b14777bc56a19d3252d7fa5b47ee598757a0.tar.bz2 glibc-a461b14777bc56a19d3252d7fa5b47ee598757a0.zip |
Update.
2004-02-20 Ulrich Drepper <drepper@redhat.com>
* dlfcn/dlsym.c: Get ld.so loading lock before the call into ld.so.
* dlfcn/dlvsym.c: Likewise.
* elf/dl-addr.c: Get loading lock while using _dl_loaded data.
* elf/dl-fini.c: Likewise.
Patch by Shunichi Sagawa <s-sagawa@jp.fujitsu.com>.
Diffstat (limited to 'dlfcn')
-rw-r--r-- | dlfcn/dlsym.c | 13 | ||||
-rw-r--r-- | dlfcn/dlvsym.c | 13 |
2 files changed, 22 insertions, 4 deletions
diff --git a/dlfcn/dlsym.c b/dlfcn/dlsym.c index ec071d9de8..76dda5973f 100644 --- a/dlfcn/dlsym.c +++ b/dlfcn/dlsym.c @@ -1,5 +1,5 @@ /* Look up a symbol in a shared object loaded by `dlopen'. - Copyright (C) 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. + Copyright (C) 1995-2000, 2004 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 @@ -20,6 +20,8 @@ #include <dlfcn.h> #include <stddef.h> +#include <ldsodefs.h> + struct dlsym_args { /* The arguments to dlsym_doit. */ @@ -48,5 +50,12 @@ dlsym (void *handle, const char *name) args.handle = handle; args.name = name; - return (_dlerror_run (dlsym_doit, &args) ? NULL : args.sym); + /* Protect against concurrent loads and unloads. */ + __rtld_lock_lock_recursive (GL(dl_load_lock)); + + void *result = (_dlerror_run (dlsym_doit, &args) ? NULL : args.sym); + + __rtld_lock_unlock_recursive (GL(dl_load_lock)); + + return result; } diff --git a/dlfcn/dlvsym.c b/dlfcn/dlvsym.c index 62415feaac..24868456e9 100644 --- a/dlfcn/dlvsym.c +++ b/dlfcn/dlvsym.c @@ -1,5 +1,5 @@ /* Look up a versioned symbol in a shared object loaded by `dlopen'. - Copyright (C) 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. + Copyright (C) 1995-2000, 2004 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 @@ -20,6 +20,8 @@ #include <dlfcn.h> #include <stddef.h> +#include <ldsodefs.h> + struct dlvsym_args { /* The arguments to dlvsym_doit. */ @@ -51,6 +53,13 @@ __dlvsym (void *handle, const char *name, const char *version_str) args.who = RETURN_ADDRESS (0); args.version = version_str; - return (_dlerror_run (dlvsym_doit, &args) ? NULL : args.sym); + /* Protect against concurrent loads and unloads. */ + __rtld_lock_lock_recursive (GL(dl_load_lock)); + + void *result = (_dlerror_run (dlvsym_doit, &args) ? NULL : args.sym); + + __rtld_lock_unlock_recursive (GL(dl_load_lock)); + + return result; } weak_alias (__dlvsym, dlvsym) |