[CRIU] [PATCH v2] criu: don't use a glibc cached pid

Andrei Vagin avagin at virtuozzo.com
Wed Mar 29 12:42:38 PDT 2017


Applied

On Tue, Mar 28, 2017 at 07:30:50AM +0300, Andrei Vagin wrote:
> From: Andrei Vagin <avagin at virtuozzo.com>
> 
> In glibc 2.24, getpid() returns a parent PID, if a child was created
> with the CLONE_VM flag.
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=17214
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=857909
> 
> The glibc git contains the next patch, which removes cached pid too:
>  commit c579f48edba88380635ab98cb612030e3ed8691e
>  Author: Adhemerval Zanella <adhemerval.zanella at linaro.org>
>  Date:   Mon Oct 10 15:08:39 2016 -0300
> 
>     Remove cached PID/TID in clone
> 
> Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
> ---
>  criu/util.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/criu/util.c b/criu/util.c
> index 221e4f9..558d498 100644
> --- a/criu/util.c
> +++ b/criu/util.c
> @@ -1400,3 +1400,12 @@ out_munmap:
>  	munmap(stack, size);
>  	return ret;
>  }
> +
> +/*
> + * In glibc 2.24, getpid() returns a parent PID, if a child was
> + * created with the CLONE_VM flag.
> + */
> +int getpid()
> +{
> +       return syscall(__NR_getpid);
> +}
> -- 
> 2.7.4
> 


More information about the CRIU mailing list