This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug dynamic-link/19448] New: deadlock in dlopen when ctor calls dlopen in another thread
- From: "nszabolcs at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 12 Jan 2016 10:48:31 +0000
- Subject: [Bug dynamic-link/19448] New: deadlock in dlopen when ctor calls dlopen in another thread
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=19448
Bug ID: 19448
Summary: deadlock in dlopen when ctor calls dlopen in another
thread
Product: glibc
Version: 2.22
Status: NEW
Severity: normal
Priority: P2
Component: dynamic-link
Assignee: unassigned at sourceware dot org
Reporter: nszabolcs at gmail dot com
Target Milestone: ---
an internal lock is held in dlopen while user code is executed (ctors).
this means user code can deadlock dlopen, observably breaking semantics
assuming thread creation is allowed in ctors.
thread creation is needed for the deadlock because GL(dl_load_lock) is
a recursive lock.
// main.c
#include <dlfcn.h>
int main()
{
dlopen("mod.so", RTLD_NOW); // lock is held during ctors
}
// mod.c
#include <dlfcn.h>
#include <pthread.h>
static void *start(void *a)
{
dlopen("xxx", RTLD_NOW); // lock in ctor in another thread
return 0;
}
__attribute__((constructor)) static void foo(void)
{
pthread_t td;
pthread_create(&td, 0, start, 0);
pthread_join(td, 0); // main thread waits here
}
--
You are receiving this mail because:
You are on the CC list for the bug.