[CRIU] [PATCH 2/3]v2 mem: if no parent image persists, can't rely on it

Tikhomirov Pavel snorcht at gmail.com
Wed Apr 16 06:05:48 PDT 2014


here was bug cause if e.g.: iterative snapshots are made and
between two of them new process in process tree was created,
it can have pages which are non dirty, and won't save them
into image. but there is no parent image for it.

pages which are non soft-dirty appear if process with some pages
in non dirty state forks, child will inherit those pte's
and if child don't write to those pages, they will be still in non
soft-dirty state when next dump comes.

also this bug was not catched because of error in zdtm, look 3/3 

v2: simplify, add more justification in commit message.

Signed-off-by: Tikhomirov Pavel <snorcht at gmail.com>
---
 mem.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mem.c b/mem.c
index ef1d010..46dee60 100644
--- a/mem.c
+++ b/mem.c
@@ -106,7 +106,7 @@ static inline bool page_in_parent(u64 pme)
  * the memory contents is present in the pagent image set.
  */
 
-static int generate_iovs(struct vma_area *vma, struct page_pipe *pp, u64 *map, u64 *off)
+static int generate_iovs(struct vma_area *vma, struct page_pipe *pp, u64 *map, u64 *off, bool parent)
 {
 	u64 *at = &map[PAGE_PFN(*off)];
 	unsigned long pfn, nr_to_scan;
@@ -130,7 +130,7 @@ static int generate_iovs(struct vma_area *vma, struct page_pipe *pp, u64 *map, u
 		 * page. The latter would be checked in page-xfer.
 		 */
 
-		if (page_in_parent(at[pfn])) {
+		if (page_in_parent(at[pfn]) && parent) {
 			ret = page_pipe_add_hole(pp, vaddr);
 			pages[0]++;
 		} else {
@@ -282,7 +282,7 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl,
 		if (!map)
 			goto out_xfer;
 again:
-		ret = generate_iovs(vma_area, pp, map, &off);
+		ret = generate_iovs(vma_area, pp, map, &off, xfer.parent);
 		if (ret == -EAGAIN) {
 			BUG_ON(pp_ret);
 
-- 
1.8.3.2



More information about the CRIU mailing list