[CRIU] [PATCH] zdtm: set the dumpable flag after setuid and setgid

Andrey Vagin avagin at openvz.org
Mon Aug 26 08:32:52 EDT 2013


setuid and setgid drops the dumpable flag, so it should be set back.
Otherwise proccesses will not able to read a few files in proc (e.g.
/proc/pid/pagemap).

This patch affects cow01:
11:50:04.429:     4: ERR: cow01.c:99: Unable to read data (errno = 13 (No such file or directory))

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 test/zdtm/lib/test.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/test/zdtm/lib/test.c b/test/zdtm/lib/test.c
index 7c950bc..fa802c2 100644
--- a/test/zdtm/lib/test.c
+++ b/test/zdtm/lib/test.c
@@ -13,6 +13,7 @@
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <string.h>
+#include <sys/prctl.h>
 
 #include "zdtmtst.h"
 #include "lock.h"
@@ -130,6 +131,11 @@ void test_init(int argc, char **argv)
 		exit(1);
 	}
 
+	if (prctl(PR_SET_DUMPABLE, 1)) {
+		pr_perror("Can't set the dumpable flag");
+		exit(1);
+	}
+
 	if (sigaction(SIGTERM, &sa, NULL)) {
 		fprintf(stderr, "Can't set SIGTERM handler: %m\n");
 		exit(1);
-- 
1.8.3.1



More information about the CRIU mailing list