This is the mail archive of the libc-alpha@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]

Re: [PATCH] Fix possible deadlock in stdio locking code


Siddhesh Poyarekar wrote:

> 	while(1) {
> 		int child = fork();
>
> 		if (child == 0)
> 			exit(0);

POSIX explains (under fork()):

	If a multi-threaded process calls fork( ), the new process
	shall contain a replica of the calling thread and its entire
	address space, possibly including the states of mutexes and
	other resources. Consequently, to avoid errors, the child
	process may only execute async-signal-safe operations until
	such time as one of the exec functions is called.

exit() is not async-signal-safe, though _exit() is.  I don't think
that glibc is the right tool to diagnose or work around application
problems like this.  (Maybe helgrind could be tweaked to make the
diagnosis.)


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