[CRIU] [PATCHv0 1/8] page-xfer: fix wrong hole address offset

Eugene Batalov eabatalov89 at gmail.com
Sun Dec 6 05:15:17 PST 2015


From: Fyodor <bocharovfedor at gmail.com>

When dumping holes we must use same offset as for pages so that all
addresses in image remained valid.

Signed-off-by: Fyodor Bocharov <fbocharov at yandex.ru>
Signed-off-by: Eugene Batalov <eabatalov89 at gmail.com>
---
 page-xfer.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/page-xfer.c b/page-xfer.c
index f7da2d2..cb6073a 100644
--- a/page-xfer.c
+++ b/page-xfer.c
@@ -699,6 +699,8 @@ int page_xfer_dump_pages(struct page_xfer *xfer, struct page_pipe *pp,
 			struct iovec *iov = &ppb->iov[i];
 
 			while (hole && (hole->iov_base < iov->iov_base)) {
+				BUG_ON(hole->iov_base < (void *)off);
+				hole->iov_base -= off;
 				pr_debug("\th %p [%u]\n", hole->iov_base,
 						(unsigned int)(hole->iov_len / PAGE_SIZE));
 				if (xfer->write_hole(xfer, hole))
@@ -722,6 +724,8 @@ int page_xfer_dump_pages(struct page_xfer *xfer, struct page_pipe *pp,
 	}
 
 	while (hole) {
+		BUG_ON(hole->iov_base < (void *)off);
+		hole->iov_base -= off;
 		pr_debug("\th* %p [%u]\n", hole->iov_base,
 				(unsigned int)(hole->iov_len / PAGE_SIZE));
 		if (xfer->write_hole(xfer, hole))
-- 
1.9.1



More information about the CRIU mailing list