[CRIU] [PATCH] lazy-pages: fix off-by-one in remap_lazy_iovs

Mike Rapoport rppt at linux.vnet.ibm.com
Thu Jul 6 10:19:23 MSK 2017


When the remap 'from' parameter matches an IOV end we try to split that IOV
exactly at its end and effectively create an IOV with zero length.
With the off-by-one fix we will skip the IOV in such case as expected.

Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
 criu/uffd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/criu/uffd.c b/criu/uffd.c
index d631f4b..703dc43 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -481,7 +481,7 @@ static int remap_lazy_iovs(struct lazy_pages_info *lpi, unsigned long from,
 	list_for_each_entry_safe(iov, n, &lpi->iovs, l) {
 		unsigned long iov_end = iov->base + iov->len;
 
-		if (from > iov_end)
+		if (from >= iov_end)
 			continue;
 
 		if (len <= 0 || from + len < iov->base)
-- 
2.7.4



More information about the CRIU mailing list