[CRIU] [PATCH] restore: unset dumpable flag for zombies

Andrew Vagin avagin at openvz.org
Tue Aug 6 10:42:10 EDT 2013


We have already tried to prevent generating core files for zombies:

commit 6da52216ce8e47fed0ded1c5a451968ef7c177a2
Author: Andrey Vagin <avagin at openvz.org>
Date:   Fri Jul 12 18:14:23 2013 +0400

    restore: set the zero limit for RLIMIT_CORE

But it doesn't work if a core file is sent into a pipe.
This functionality is used by the abrt daemon for example.

This patch uses more direct way, it unsets the dumpable flag with help
of PR_SET_DUMPABLE.

Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
 cr-restore.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cr-restore.c b/cr-restore.c
index b06e3b9..67a55d4 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -19,6 +19,7 @@
 #include <sys/file.h>
 #include <sys/shm.h>
 #include <sys/mount.h>
+#include <sys/prctl.h>
 
 #include <sched.h>
 
@@ -752,6 +753,7 @@ static int restore_one_zombie(int pid, CoreEntry *core)
 		struct rlimit rlim = {0, 0};
 		int signr;
 
+		prctl(PR_SET_DUMPABLE, 0, 0, 0, 0);
 		/* prevent generating core files */
 		if (setrlimit(RLIMIT_CORE, &rlim))
 			pr_perror("Can't set the zero limit for core files");
-- 
1.8.3.1



More information about the CRIU mailing list