Skip to content

Commit f5a8e85

Browse files
committed
fix: temp patch to include the lookup for pagehole in acestors patch
From checkpoint-restore/criu#2739
1 parent 4c3cd19 commit f5a8e85

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ ExternalProject_Add(criu
9494
URL ${DEP_criu_URL}
9595
URL_HASH SHA256=${DEP_criu_SHA256}
9696
UPDATE_DISCONNECTED 1
97-
PATCH_COMMAND patch -p1 -i ${CMAKE_SOURCE_DIR}/patch/criu-build.patch && patch -p1 -i ${CMAKE_SOURCE_DIR}/patch/criu-static-plugin.patch
97+
PATCH_COMMAND patch -p1 -i ${CMAKE_SOURCE_DIR}/patch/criu-build.patch && patch -p1 -i ${CMAKE_SOURCE_DIR}/patch/criu-static-plugin.patch && patch -p1 -i ${CMAKE_SOURCE_DIR}/patch/pagehole-fix.patch
9898
CONFIGURE_COMMAND ""
9999
DOWNLOAD_DIR ${SOURCE_DOWNLOADS_DIR}
100100
DOWNLOAD_NAME ${DEP_criu_FILENAME}

patch/pagehole-fix.patch

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
diff --git a/criu/page-xfer.c b/criu/page-xfer.c
2+
index 0314963e6d..4291d9bc27 100644
3+
--- a/criu/page-xfer.c
4+
+++ b/criu/page-xfer.c
5+
@@ -279,6 +279,7 @@ static int check_pagehole_in_parent(struct page_read *p, struct iovec *iov)
6+
{
7+
int ret;
8+
unsigned long off, end;
9+
+ struct page_read *curr_parent;
10+
11+
/*
12+
* Try to find pagemap entry in parent, from which
13+
@@ -294,21 +295,31 @@ static int check_pagehole_in_parent(struct page_read *p, struct iovec *iov)
14+
while (1) {
15+
unsigned long pend;
16+
17+
- ret = p->seek_pagemap(p, off);
18+
- if (ret <= 0 || !p->pe) {
19+
- pr_err("Missing %lx in parent pagemap\n", off);
20+
- return -1;
21+
+ /* Try to find the page in the parent chain */
22+
+ curr_parent = p;
23+
+ while (curr_parent) {
24+
+ ret = curr_parent->seek_pagemap(curr_parent, off);
25+
+ if (ret > 0 && curr_parent->pe) {
26+
+ /* Found it! */
27+
+ pr_debug("\tFound %" PRIx64 "/%lu in parent chain\n",
28+
+ curr_parent->pe->vaddr, pagemap_len(curr_parent->pe));
29+
+ pend = curr_parent->pe->vaddr + pagemap_len(curr_parent->pe);
30+
+ goto found;
31+
+ }
32+
+ curr_parent = curr_parent->parent;
33+
}
34+
35+
- pr_debug("\tFound %" PRIx64 "/%lu\n", p->pe->vaddr, pagemap_len(p->pe));
36+
+ /* Not found in any parent */
37+
+ pr_err("Missing %lx in parent pagemap chain\n", off);
38+
+ return -1;
39+
40+
+found:
41+
/*
42+
* The pagemap entry in parent may happen to be
43+
* shorter, than the hole we write. In this case
44+
* we should go ahead and check the remainder.
45+
*/
46+
47+
- pend = p->pe->vaddr + pagemap_len(p->pe);
48+
if (end <= pend)
49+
return 0;

0 commit comments

Comments
 (0)