Commit e01dc7fa authored by Tikhomirov Pavel's avatar Tikhomirov Pavel Committed by Pavel Emelyanov

v2 mem: if no parent image persists, can't rely on it

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: 's avatarTikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 8df87994
...@@ -106,7 +106,7 @@ static inline bool page_in_parent(u64 pme) ...@@ -106,7 +106,7 @@ static inline bool page_in_parent(u64 pme)
* the memory contents is present in the pagent image set. * 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 has_parent)
{ {
u64 *at = &map[PAGE_PFN(*off)]; u64 *at = &map[PAGE_PFN(*off)];
unsigned long pfn, nr_to_scan; 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 ...@@ -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. * page. The latter would be checked in page-xfer.
*/ */
if (page_in_parent(at[pfn])) { if (has_parent && page_in_parent(at[pfn])) {
ret = page_pipe_add_hole(pp, vaddr); ret = page_pipe_add_hole(pp, vaddr);
pages[0]++; pages[0]++;
} else { } else {
...@@ -282,7 +282,7 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl, ...@@ -282,7 +282,7 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl,
if (!map) if (!map)
goto out_xfer; goto out_xfer;
again: again:
ret = generate_iovs(vma_area, pp, map, &off); ret = generate_iovs(vma_area, pp, map, &off, xfer.parent);
if (ret == -EAGAIN) { if (ret == -EAGAIN) {
BUG_ON(pp_ret); BUG_ON(pp_ret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment