This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] [BZ #15392] Remove fork child pid assertion
- From: Torvald Riegel <triegel at redhat dot com>
- To: Ricky Zhou <rickyz at chromium dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 17 Nov 2014 11:38:11 +0100
- Subject: Re: [PATCH] [BZ #15392] Remove fork child pid assertion
- Authentication-results: sourceware.org; auth=none
- References: <1416014955-5408-1-git-send-email-rickyz at chromium dot org>
On Fri, 2014-11-14 at 17:29 -0800, Ricky Zhou wrote:
> This assertion is no longer always true, since a forked child may be in
> a different PID namespace than its parent, and the two namespace may
> have PID collisions.
If that's true, process-shared synchronization facilities based on the
thread ID (e.g., mutexes) might not work anymore.
Do we at least need a note in the documentation that this is the case?
Or do we still need to implement it?
Is there any glibc-internal synchronization that this could break?
I believe we deal with these issues before dropping the assert.
> An example program which hits this assert is attached to bug 17596.
>
> [BZ #15392]
> * sysdeps/nptl/fork.c (__libc_fork): Remove assert that the parent
> and child pid must differ after forking.
> ---
> sysdeps/nptl/fork.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c
> index a7dafa8..6adb723 100644
> --- a/sysdeps/nptl/fork.c
> +++ b/sysdeps/nptl/fork.c
> @@ -139,8 +139,6 @@ __libc_fork (void)
> {
> struct pthread *self = THREAD_SELF;
>
> - assert (THREAD_GETMEM (self, tid) != ppid);
> -
> /* See __pthread_once. */
> if (__fork_generation_pointer != NULL)
> *__fork_generation_pointer += __PTHREAD_ONCE_FORK_GEN_INCR;