Bug#489066: glibc: dlclose() from threaded program on GNU/kFreeBSD segfaults
Package: glibc
Severity: wishlist
Version: 2.7-12
User: glibc-bsd-devel@lists.alioth.debian.org
Usertags: kfreebsd
Hi,
the code bellow crashes on GNU/kFreeBSD.
It crashes from both initial thread and created thread,
but a thread have to be created (thread manager have to be started),
it does not crash without RTLD_GLOBAL, loaded lib
(i.e. /lib/libutil.so.1) is not important.
It might be GNU/kFreeBSD specific or linuxthreads specific.
Please, could you test whether it crashes also on hppa ?
Thanks in advance
Petr
/* gcc a.c -ldl -pthread -O2 */
#include <dlfcn.h>
#include <pthread.h>
#include <stdio.h>
void *p;
int dl(void)
{
p = dlopen("/lib/libutil.so.1", RTLD_NOW | RTLD_GLOBAL);
printf("dlopen: %p\n",p);
dlclose(p);
printf("dlclose: %p\n",p);
};
int sl(void)
{
sleep(5);
}
int main()
{
pthread_t r;
#if 0
pthread_create(&r, NULL,dl,NULL);
sleep(1);
#else
pthread_create(&r, NULL,sl,NULL);
sleep(1);
dl();
#endif
}
Reply to: