[lxc-devel] [PATCH 1/1] lxc_attach: Use clone() instead of second fork()

Serge Hallyn serge.hallyn at ubuntu.com
Thu Apr 25 13:42:37 UTC 2013


Quoting Christian Seiler (christian at iwakd.de):
> Because of an assertion in glibc's fork() wrapper that parent pid and
> pid of child should never be the same, one should avoid fork() after
> attaching to a PID namespace, since the pid inside the namespace may
> coincide with the pid of the parent outside the namespace, thus hitting
> the aforementioned assertion.
> 
> This patch just changes the code in the most simple manner to use
> clone() instead of fork(). Since clone() requires a function to be
> called instead of returning 0, we move the code of the child into a
> function child_main.
> 
> Signed-off-by: Christian Seiler <christian at iwakd.de>

Thanks, Christian.

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>




More information about the lxc-devel mailing list