[CRIU] [PATCH] parasite: unprotect VMA-s if one of DUMPPAGES operations failed
Andrey Vagin
avagin at openvz.org
Fri Jun 14 09:44:27 EDT 2013
PARASITE_CMD_DUMPPAGES is called many times and the parasite args
contains an array with vmas at this time, so VMAs can be unprotected in
error case
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
pie/parasite.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/pie/parasite.c b/pie/parasite.c
index 2570cb4..0e828ea 100644
--- a/pie/parasite.c
+++ b/pie/parasite.c
@@ -22,6 +22,12 @@ static int tsock = -1;
static struct rt_sigframe *sigframe;
+/*
+ * PARASITE_CMD_DUMPPAGES is called many times and the parasite args contains
+ * an array of VMAs at this time, so VMAs can be unprotected in any moment
+ */
+static struct parasite_dump_pages_args *mprotect_args = NULL;
+
#ifndef SPLICE_F_GIFT
#define SPLICE_F_GIFT 0x08
#endif
@@ -42,6 +48,11 @@ static int mprotect_vmas(struct parasite_dump_pages_args *args)
}
}
+ if (args->add_prot)
+ mprotect_args = args;
+ else
+ mprotect_args = NULL;
+
return ret;
}
@@ -435,6 +446,11 @@ static int fini()
{
unsigned long new_sp;
+ if (mprotect_args) {
+ mprotect_args->add_prot = 0;
+ mprotect_vmas(mprotect_args);
+ }
+
new_sp = (long)sigframe + SIGFRAME_OFFSET;
pr_debug("%ld: new_sp=%lx ip %lx\n", sys_gettid(),
new_sp, RT_SIGFRAME_REGIP(sigframe));
--
1.8.2
More information about the CRIU
mailing list