[Bug 198452] libthr/rtld deadlock
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Mon Mar 9 14:00:04 UTC 2015
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198452
Bug ID: 198452
Summary: libthr/rtld deadlock
Product: Base System
Version: 11.0-CURRENT
Hardware: amd64
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: threads
Assignee: freebsd-threads at FreeBSD.org
Reporter: dpejesh at yahoo.com
I've run into what appears to be a deadlock with the following code when linked
against libthr. Prior to base r245630 this worked as intended. Reverting
base r245630 and base r249425 in HEAD appears to fix it.
#include <dlfcn.h>
#include <link.h>
int32_t callback(struct dl_phdr_info *info, size_t size, void *data) {
dlopen(info->dlpi_name, RTLD_LAZY);
return 0;
}
int main() {
dl_iterate_phdr(callback, 0);
return 0;
}
When linked with libthr the program deadlocks on the call to dlopen().
clang -g -lthr -o main main.c
The backtrace I'm seeing is:
(gdb) bt
#0 0x0000000800833ddc in _umtx_op_err () from /lib/libthr.so.3
#1 0x000000080082a29f in __thr_rwlock_wrlock (rwlock=0x800a42900,
tsp=<optimized out>) at /usr/src/lib/libthr/thread/thr_umtx.c:296
#2 0x00000008008317f3 in _thr_rwlock_wrlock (rwlock=<optimized out>,
tsp=<optimized out>) at /usr/src/lib/libthr/thread/thr_umtx.h:204
#3 _thr_rtld_wlock_acquire (lock=0x800a42900) at
/usr/src/lib/libthr/thread/thr_rtld.c:141
#4 0x000000080060b5c2 in wlock_acquire (lock=0x80081f8a0 <rtld_locks>,
lockstate=0x7fffffffe058) at /usr/src/libexec/rtld-elf/rtld_lock.c:213
#5 0x000000080060905f in dlopen_object () from /libexec/ld-elf.so.1
#6 0x00000008006060a3 in rtld_dlopen (name=0x7fffffffefcc
"/root/deadlock/main", fd=-1, mode=<optimized out>) at
/usr/src/libexec/rtld-elf/rtld.c:2955
#7 0x000000000040081f in callback (info=0x7fffffffeb08, size=64, data=0x0) at
main.c:7
#8 0x0000000800606eeb in dl_iterate_phdr (callback=0x4007e0 <callback>,
param=0x0) at /usr/src/libexec/rtld-elf/rtld.c:3416
#9 0x0000000000400858 in main () at main.c:12
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-threads
mailing list