[CRIU] [PATCH 1/7] Skip adding PROT_READ flag
Abhishek Dubey
dubeyabhishek777 at gmail.com
Wed Aug 21 02:06:56 MSK 2019
"read" mode pre-dump implementation uses
process_vm_readv syscall, which skips
processing memory region that lacks the
PROT_READ protection. So, PROT_READ must
be added only during "splice" mode and
not to "read" mode pre-dumping.
Signed-off-by: Abhishek Dubey <dubeyabhishek777 at gmail.com>
---
criu/mem.c | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/criu/mem.c b/criu/mem.c
index de66a62..e19688d 100644
--- a/criu/mem.c
+++ b/criu/mem.c
@@ -530,16 +530,18 @@ int parasite_dump_pages_seized(struct pstree_item *item,
* Afterwards -- reprotect memory back.
*/
- pargs->add_prot = PROT_READ;
- ret = compel_rpc_call_sync(PARASITE_CMD_MPROTECT_VMAS, ctl);
- if (ret) {
- pr_err("Can't dump unprotect vmas with parasite\n");
- return ret;
- }
+ if (!mdc->pre_dump || mdc->pre_dump == PRE_DUMP_SPLICE) {
+ pargs->add_prot = PROT_READ;
+ ret = compel_rpc_call_sync(PARASITE_CMD_MPROTECT_VMAS, ctl);
+ if (ret) {
+ pr_err("Can't dump unprotect vmas with parasite\n");
+ return ret;
+ }
- if (fault_injected(FI_DUMP_PAGES)) {
- pr_err("fault: Dump VMA pages failure!\n");
- return -1;
+ if (fault_injected(FI_DUMP_PAGES)) {
+ pr_err("fault: Dump VMA pages failure!\n");
+ return -1;
+ }
}
ret = __parasite_dump_pages_seized(item, pargs, vma_area_list, mdc, ctl);
@@ -549,10 +551,12 @@ int parasite_dump_pages_seized(struct pstree_item *item,
return ret;
}
- pargs->add_prot = 0;
- if (compel_rpc_call_sync(PARASITE_CMD_MPROTECT_VMAS, ctl)) {
- pr_err("Can't rollback unprotected vmas with parasite\n");
- ret = -1;
+ if (!mdc->pre_dump || mdc->pre_dump == PRE_DUMP_SPLICE) {
+ pargs->add_prot = 0;
+ if (compel_rpc_call_sync(PARASITE_CMD_MPROTECT_VMAS, ctl)) {
+ pr_err("Can't rollback unprotected vmas with parasite\n");
+ ret = -1;
+ }
}
return ret;
--
2.7.4
More information about the CRIU
mailing list