public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "olma_ru at yahoo dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug libc/13502] New: SEGFAULT in fork() when pthread_atfork() was called from a library loaded/unloaded with dlopen/dlclose
Date: Thu, 15 Dec 2011 12:17:00 -0000	[thread overview]
Message-ID: <bug-13502-131@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2011-12-15 12:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-15 12:17 olma_ru at yahoo dot com [this message]
2011-12-15 12:18 ` [Bug libc/13502] " olma_ru at yahoo dot com
2012-12-19 10:46 ` schwab@linux-m68k.org
2013-09-21 20:21 ` neleai at seznam dot cz
2013-09-22  5:22 ` bugdal at aerifal dot cx
2013-10-03  1:17 ` carlos at redhat dot com
2014-06-27 11:31 ` fweimer at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-13502-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).