path: root/lib/libc/sys/interposing_table.c
diff options
authorKonstantin Belousov <kib@FreeBSD.org>2016-02-08 19:24:13 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2016-02-08 19:24:13 +0000
commitbd43f0691c95603818dd7df72f24ee318bb0f29f (patch)
treec91cbb77944f06638bce887f736eaeafed34a388 /lib/libc/sys/interposing_table.c
parent43a45064a0975acef2f95bd0c41eafdcfa6cbafc (diff)
If libthr.so is dlopened without RTLD_GLOBAL flag, the libthr symbols
do not participate in the global symbols namespace, but rtld locks are still replaced and functions are interposed. In particular, __pthread_map_stacks_exec is resolved to the libc version. If a library is loaded later, which requires adjustment of the stack protection mode, rtld calls into libc __pthread_map_stacks_exec due to the symbols scope. The libc version might recurse into binder and recursively acquire rtld bind lock, causing the hang. Make libc __pthread_map_stacks_exec() interposed, which synchronizes rtld locks and version of the stack exec hook when libthr loaded, regardless of the symbol scope control or symbol resolution order. The __pthread_map_stacks_exec() symbol is removed from the private version in libthr since libc symbol now operates correctly in presence of libthr. Reported and tested by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
Notes: svn path=/head/; revision=295407
Diffstat (limited to 'lib/libc/sys/interposing_table.c')
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libc/sys/interposing_table.c b/lib/libc/sys/interposing_table.c
index 08dfbb15b153..75bb2804b759 100644
--- a/lib/libc/sys/interposing_table.c
+++ b/lib/libc/sys/interposing_table.c
@@ -78,6 +78,7 @@ interpos_func_t __libc_interposing[INTERPOS_MAX] = {
SLOT(kevent, __sys_kevent),
SLOT(wait6, __sys_wait6),
SLOT(ppoll, __sys_ppoll),
+ SLOT(map_stacks_exec, __libc_map_stacks_exec),
#undef SLOT