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

Tikhomirov Pavel snorcht at gmail.com
Wed Apr 9 02:34:05 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,
criu will assume that all pages of this new process are "clean"
believing that there is previous image for it and dirty tracking
is on, but non of that is true, and it will end up in fail on restore.
    
also this bug was not catched because of error in zdtm, look 3/3

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..6df198c 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 no_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]) && !no_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 == NULL);
 		if (ret == -EAGAIN) {
 			BUG_ON(pp_ret);
 
-- 
1.8.3.2



More information about the CRIU mailing list