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

Andrei Vagin avagin at openvz.org
Mon Mar 27 18:35:30 PDT 2017


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 38387ff..0671853 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -1393,3 +1393,12 @@ out_close:
 out_munmap:
 	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