[CRIU] [PATCH 1/5] dump: support SYSV IPC vma

Kinsbursky Stanislav skinsbursky at openvz.org
Tue Feb 14 12:19:49 EST 2012


This patch introduces the following changes:
1) introduces new flag VMA_AREA_SYSVIPC to mark corresponding vma entries.
2) enhance task /proc/<pid>/maps parsing to obtain first 5 letters of mapped
file. If device major file belong to ins equal to 0 (tmpfs) and it's name
starts with "/SYSV", then this mapping is considered as SYSV IPC and
corresponding vma entry status is updated with VMA_AREA_SYSVIPC flag.
3) omit dumping of mapping pages for SYSV IPC vmas.

Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>

---
 include/image.h    |    2 ++
 parasite-syscall.c |    4 ++++
 proc_parse.c       |   14 +++++++++++---
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/include/image.h b/include/image.h
index 26eaf65..c9b7209 100644
--- a/include/image.h
+++ b/include/image.h
@@ -176,6 +176,8 @@ struct ipc_sem_entry {
 #define VMA_ANON_SHARED		(1 <<  8)
 #define VMA_ANON_PRIVATE	(1 <<  9)
 
+#define VMA_AREA_SYSVIPC	(1 <<  10)
+
 #define vma_entry_is(vma, s)	(((vma)->status & (s)) == (s))
 #define vma_entry_len(vma)	((vma)->end - (vma)->start)
 #define final_vma_entry(vma)	((vma)->start == 0 && (vma)->end == 0)
diff --git a/parasite-syscall.c b/parasite-syscall.c
index 14b17c5..f6c13d0 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -448,6 +448,10 @@ int parasite_dump_pages_seized(struct parasite_ctl *ctl, struct list_head *vma_a
 		if (vma_area->vma.status & VMA_FILE_SHARED)
 			continue;
 
+		/* No dumps for SYSV IPC mappings */
+		if (vma_area->vma.status & VMA_AREA_SYSVIPC)
+			continue;
+
 		pr_info_vma(vma_area);
 		parasite_dumppages.vma_entry = vma_area->vma;
 
diff --git a/proc_parse.c b/proc_parse.c
index 87b9626..8c607de 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -45,11 +45,14 @@ int parse_maps(pid_t pid, int pid_dir, struct list_head *vma_area_list, bool use
 	while (fgets(big_buffer, sizeof(big_buffer), maps)) {
 		struct stat st_buf;
 		int num;
+		char file_path[6];
 
-		num = sscanf(big_buffer, "%lx-%lx %c%c%c%c %lx %02x:%02x %lu",
+
+		memset(file_path, 0, 6);
+		num = sscanf(big_buffer, "%lx-%lx %c%c%c%c %lx %02x:%02x %lu %5s",
 			     &start, &end, &r, &w, &x, &s, &pgoff, &dev_maj,
-			     &dev_min, &ino);
-		if (num != 10) {
+			     &dev_min, &ino, file_path);
+		if (num < 10) {
 			pr_err("Can't parse: %s", big_buffer);
 			goto err;
 		}
@@ -133,6 +136,11 @@ int parse_maps(pid_t pid, int pid_dir, struct list_head *vma_area_list, bool use
 				vma_area->vma.flags  |= MAP_ANONYMOUS;
 				vma_area->vma.status |= VMA_ANON_SHARED;
 				vma_area->shmid = st_buf.st_ino;
+
+				if (!strcmp(file_path, "/SYSV")) {
+					pr_perror("path: %s\n", file_path);
+					vma_area->vma.status |= VMA_AREA_SYSVIPC;
+				}
 			} else {
 				if (vma_area->vma.flags & MAP_PRIVATE)
 					vma_area->vma.status |= VMA_FILE_PRIVATE;



More information about the CRIU mailing list