[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

dlclose() from threaded program segfaults



Hello,

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 is a regression compared to etch glibc.
It might be GNU/kFreeBSD specific or linuxthreads specific.

Please, could someone with access to hppa test whether
it crashes also on hppa debian 2.7 glibc ?

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: