summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2008-05-06 09:27:41 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2008-05-06 09:27:41 +0000
commite91ff25c0c0b2bd0d7d8bd5b1c96457bf2bef352 (patch)
tree0d4b4b84b2ad5fa15e5d4e4caee3794dae371904
parentcf181aee600f9c7e459ef27860be83ef40ae3970 (diff)
downloadsrc-test2-e91ff25c0c0b2bd0d7d8bd5b1c96457bf2bef352.tar.gz
src-test2-e91ff25c0c0b2bd0d7d8bd5b1c96457bf2bef352.zip
Notes
-rw-r--r--libexec/rtld-elf/rtld.c8
-rw-r--r--libexec/rtld-elf/rtld_lock.c3
-rw-r--r--libexec/rtld-elf/rtld_lock.h1
3 files changed, 8 insertions, 4 deletions
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index ad276327209c..ec68eea714e5 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -2129,9 +2129,10 @@ dl_iterate_phdr(__dl_iterate_hdr_callback callback, void *param)
{
struct dl_phdr_info phdr_info;
const Obj_Entry *obj;
- int error, lockstate;
+ int error, bind_lockstate, phdr_lockstate;
- lockstate = rlock_acquire(rtld_bind_lock);
+ phdr_lockstate = wlock_acquire(rtld_phdr_lock);
+ bind_lockstate = rlock_acquire(rtld_bind_lock);
error = 0;
@@ -2150,7 +2151,8 @@ dl_iterate_phdr(__dl_iterate_hdr_callback callback, void *param)
break;
}
- rlock_release(rtld_bind_lock, lockstate);
+ rlock_release(rtld_bind_lock, bind_lockstate);
+ wlock_release(rtld_phdr_lock, phdr_lockstate);
return (error);
}
diff --git a/libexec/rtld-elf/rtld_lock.c b/libexec/rtld-elf/rtld_lock.c
index 1d77fe105591..c67f5fb0d545 100644
--- a/libexec/rtld-elf/rtld_lock.c
+++ b/libexec/rtld-elf/rtld_lock.c
@@ -171,7 +171,7 @@ thread_mask_clear(int mask)
lockinfo.thread_clr_flag(mask);
}
-#define RTLD_LOCK_CNT 2
+#define RTLD_LOCK_CNT 3
struct rtld_lock {
void *handle;
int mask;
@@ -179,6 +179,7 @@ struct rtld_lock {
rtld_lock_t rtld_bind_lock = &rtld_locks[0];
rtld_lock_t rtld_libc_lock = &rtld_locks[1];
+rtld_lock_t rtld_phdr_lock = &rtld_locks[2];
int
rlock_acquire(rtld_lock_t lock)
diff --git a/libexec/rtld-elf/rtld_lock.h b/libexec/rtld-elf/rtld_lock.h
index cca4f18ed14f..2e3f95422720 100644
--- a/libexec/rtld-elf/rtld_lock.h
+++ b/libexec/rtld-elf/rtld_lock.h
@@ -52,6 +52,7 @@ typedef struct rtld_lock *rtld_lock_t;
extern rtld_lock_t rtld_bind_lock;
extern rtld_lock_t rtld_libc_lock;
+extern rtld_lock_t rtld_phdr_lock;
int rlock_acquire(rtld_lock_t);
int wlock_acquire(rtld_lock_t);