[CRIU] [PATCH] crtools: don't prevent to dump memory mappings on /dev/zero (v2)

Andrey Vagin avagin at openvz.org
Thu Jan 17 05:45:11 EST 2013


Oracle has such mappings.

v2: add check, that a file is a character device

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 include/util.h | 2 ++
 proc_parse.c   | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/util.h b/include/util.h
index 0fa5003..6ce0783 100644
--- a/include/util.h
+++ b/include/util.h
@@ -263,6 +263,8 @@ int do_open_proc(pid_t pid, int flags, const char *fmt, ...);
 #define pr_img_head(type, ...)	pr_msg("\n"#type __VA_ARGS__ "\n----------------\n")
 #define pr_img_tail(type)	pr_msg("----------------\n")
 
+#define DEVZERO		(makedev(1, 5))
+
 #define KDEV_MINORBITS	20
 #define KDEV_MINORMASK	((1UL << KDEV_MINORBITS) - 1)
 #define MKKDEV(ma, mi)	(((ma) << KDEV_MINORBITS) | (mi))
diff --git a/proc_parse.c b/proc_parse.c
index 83c4ef9..5b32b5c 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -301,7 +301,9 @@ int parse_smaps(pid_t pid, struct list_head *vma_area_list, bool use_map_files)
 				pr_perror("Failed fstat on %d's map %lu", pid, start);
 				goto err;
 			}
-			if (!S_ISREG(st_buf.st_mode)) {
+
+			if (!S_ISREG(st_buf.st_mode) &&
+			    !(S_ISCHR(st_buf.st_mode) && st_buf.st_rdev == DEVZERO)) {
 				pr_err("Can't handle non-regular mapping on %d's map %lu\n", pid, start);
 				goto err;
 			}
-- 
1.7.11.7



More information about the CRIU mailing list