diff mbox

fork: Remove bogus parent PID assertions [BZ #21386]

Message ID 20170512102047.826C04026EAEE@oldenburg.str.redhat.com
State New
Headers show

Commit Message

Florian Weimer May 12, 2017, 10:20 a.m. UTC
2017-05-12  Florian Weimer  <fweimer@redhat.com>

	[BZ #21386]
	* sysdeps/nptl/fork.c (__libc_fork): Remove assertions on the
	parent PID.  The assertion in the child is incorrect with PID
	namespaces.

Comments

Adhemerval Zanella Netto May 12, 2017, 1:47 p.m. UTC | #1
On 12/05/2017 07:20, Florian Weimer wrote:
> 2017-05-12  Florian Weimer  <fweimer@redhat.com>
> 
> 	[BZ #21386]
> 	* sysdeps/nptl/fork.c (__libc_fork): Remove assertions on the
> 	parent PID.  The assertion in the child is incorrect with PID
> 	namespaces.

It would be better to make this Linux specific, but we can live with it.
LGTM.

> 
> diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c
> index db6d721..4bb87e2 100644
> --- a/sysdeps/nptl/fork.c
> +++ b/sysdeps/nptl/fork.c
> @@ -131,10 +131,6 @@ __libc_fork (void)
>        call_function_static_weak (__malloc_fork_lock_parent);
>      }
>  
> -#ifndef NDEBUG
> -  pid_t ppid = THREAD_GETMEM (THREAD_SELF, tid);
> -#endif
> -
>  #ifdef ARCH_FORK
>    pid = ARCH_FORK ();
>  #else
> @@ -147,8 +143,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;
> @@ -230,8 +224,6 @@ __libc_fork (void)
>      }
>    else
>      {
> -      assert (THREAD_GETMEM (THREAD_SELF, tid) == ppid);
> -
>        /* Release acquired locks in the multi-threaded case.  */
>        if (multiple_threads)
>  	{
>
diff mbox

Patch

diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c
index db6d721..4bb87e2 100644
--- a/sysdeps/nptl/fork.c
+++ b/sysdeps/nptl/fork.c
@@ -131,10 +131,6 @@  __libc_fork (void)
       call_function_static_weak (__malloc_fork_lock_parent);
     }
 
-#ifndef NDEBUG
-  pid_t ppid = THREAD_GETMEM (THREAD_SELF, tid);
-#endif
-
 #ifdef ARCH_FORK
   pid = ARCH_FORK ();
 #else
@@ -147,8 +143,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;
@@ -230,8 +224,6 @@  __libc_fork (void)
     }
   else
     {
-      assert (THREAD_GETMEM (THREAD_SELF, tid) == ppid);
-
       /* Release acquired locks in the multi-threaded case.  */
       if (multiple_threads)
 	{