[2/7] Skip generating iov for non-PROT_READ memory

Submitted by Abhishek Dubey on Aug. 25, 2019, 1:58 a.m.

Details

Message ID 1566698301-8740-3-git-send-email-dubeyabhishek777@gmail.com
State New
Series "GSoC 19: Optimizing the Pre-dump Algorithm"
Headers show

Commit Message

Abhishek Dubey Aug. 25, 2019, 1:58 a.m.
skip iov-generation corresponding to regions
not having PROT_READ, since process_vm_readv
syscall can't process them during pre-dumping
in "read" mode.

Signed-off-by: Abhishek Dubey <dubeyabhishek777@gmail.com>
---
 criu/mem.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/mem.c b/criu/mem.c
index 911b9d2..640b00a 100644
--- a/criu/mem.c
+++ b/criu/mem.c
@@ -361,6 +361,20 @@  static int generate_vma_iovs(struct pstree_item *item, struct vma_area *vma,
 				!vma_area_is(vma, VMA_ANON_SHARED))
 		return 0;
 
+	/*
+	 * process_vm_readv syscall can't copy memory regions lacking
+	 * PROT_READ flag. Therefore, avoid generating iovs for such
+	 * regions in "read" mode pre-dump. Regions skipped by pre-dumps
+	 * can't be referred as parent by following dump stage. So, mark
+	 * "has_parent=false" for such regions.
+	 */
+	if (opts.pre_dump_mode == PRE_DUMP_READ &&
+	                          !(vma->e->prot & PROT_READ)) {
+		if (pre_dump)
+			return 0;
+		has_parent = false;
+	}
+
 	if (vma_entry_is(vma->e, VMA_AREA_AIORING)) {
 		if (pre_dump)
 			return 0;