This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/13502] New: SEGFAULT in fork() when pthread_atfork() was called from a library loaded/unloaded with dlopen/dlclose


http://sourceware.org/bugzilla/show_bug.cgi?id=13502

             Bug #: 13502
           Summary: SEGFAULT in fork() when pthread_atfork() was called
                    from a library loaded/unloaded with dlopen/dlclose
           Product: glibc
           Version: 2.12
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: olma_ru@yahoo.com
    Classification: Unclassified


Created attachment 6112
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6112
reproducer

There is a shared library that calls pthread_atfork() (at least one handler
must be NOT NULL) during initialization.
There is an application that loads this shared library with dlopen() and then
unloads it with dlclose().
Then the application calls fork(). 
Segfault occurs.

It looks like atfork handlers registered with pthread_atfork() were not removed
during dlclose().

The problem can be reproduced with the attached test. 
Compile libfoo.c - "gcc -c -fPIC -o libfoo.o libfoo.c"
Create the shared library - "gcc -shared -o libfoo.so libfoo.o"
Compile fork_main.c - "gcc -o fork_main fork_main.c -ldl -lpthread"
Run ./fork_main.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]