diff options
author | kib <kib@FreeBSD.org> | 2014-06-07 02:45:24 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2014-06-07 02:45:24 +0000 |
commit | 8d9dc2de3a37d5f757fffb376a780d5081675f2e (patch) | |
tree | 747c00fc9e7b43e6077655fb1d4c318340f89b0e /libexec | |
parent | 218f93e5f8ff4d66b5b39b99db1d741e7067e773 (diff) | |
download | FreeBSD-src-8d9dc2de3a37d5f757fffb376a780d5081675f2e.zip FreeBSD-src-8d9dc2de3a37d5f757fffb376a780d5081675f2e.tar.gz |
MFC r266609:
Change the _rtld_atfork() to lock the bind lock in write mode.
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rtld-elf/rtld_lock.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libexec/rtld-elf/rtld_lock.c b/libexec/rtld-elf/rtld_lock.c index d1563e5..ea16c4d 100644 --- a/libexec/rtld-elf/rtld_lock.c +++ b/libexec/rtld-elf/rtld_lock.c @@ -365,8 +365,19 @@ _rtld_atfork_pre(int *locks) { RtldLockState ls[2]; + if (locks == NULL) + return; + + /* + * Warning: this does not work with the rtld compat locks + * above, since the thread signal mask is corrupted (set to + * all signals blocked) if two locks are taken in write mode. + * The caller of the _rtld_atfork_pre() must provide the + * working implementation of the locks, and libthr locks are + * fine. + */ wlock_acquire(rtld_phdr_lock, &ls[0]); - rlock_acquire(rtld_bind_lock, &ls[1]); + wlock_acquire(rtld_bind_lock, &ls[1]); /* XXXKIB: I am really sorry for this. */ locks[0] = ls[1].lockstate; @@ -378,6 +389,9 @@ _rtld_atfork_post(int *locks) { RtldLockState ls[2]; + if (locks == NULL) + return; + bzero(ls, sizeof(ls)); ls[0].lockstate = locks[2]; ls[1].lockstate = locks[0]; |