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/4737] New: fork is not async-signal-safe


The following test program will deadlock in ptmalloc_lock_all when using glibc
2.6 (specifically, glibc-2.6-3 as shipped in F7).

#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/time.h>

void handler(int unused)
{
        pid_t pid = fork();

        if (pid == 0) {
                exit(0);
        }
}

int main(int argc, char* argv[])
{
        struct sigaction sa;
        struct itimerval itv;

        sa.sa_handler = handler;
        sigemptyset(&sa.sa_mask);
        sa.sa_flags = SA_RESTART;

        sigaction(SIGALRM, &sa, NULL);

        itv.it_interval.tv_sec = 0;
        itv.it_interval.tv_usec = 10;
        itv.it_value.tv_sec = 0;
        itv.it_value.tv_usec = 10;

        setitimer(ITIMER_REAL, &itv, NULL);

        while (1) {
                void * p = malloc(8);
                free(p);
        }

        return 0;
}

-- 
           Summary: fork is not async-signal-safe
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: nmiell at comcast dot net
                CC: glibc-bugs at sources dot redhat dot com


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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