[CRIU] [PATCHv3 4/4] parasite-syscall: cure task without parasite with unmap
Dmitry Safonov
dsafonov at virtuozzo.com
Thu Jul 7 04:51:56 PDT 2016
In case of `criu exec`, we do not insert parasite daemon inside task.
So, we don't have the daemon which could unmap itself and by that
reason, we should unmap remote_map with hands (raw syscall).
Cc: Andrew Vagin <avagin at virtuozzo.com>
Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
criu/parasite-syscall.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
index e1bd9a970678..24544337eef8 100644
--- a/criu/parasite-syscall.c
+++ b/criu/parasite-syscall.c
@@ -1137,12 +1137,14 @@ int parasite_stop_daemon(struct parasite_ctl *ctl)
int parasite_cure_remote(struct parasite_ctl *ctl)
{
- int ret = 0;
-
if (parasite_stop_daemon(ctl))
return -1;
- if (ctl->remote_map) {
+ if (!ctl->remote_map)
+ return 0;
+
+ /* Unseizing task with parasite -- it does it himself */
+ if (ctl->addr_cmd) {
struct parasite_unmap_args *args;
*ctl->addr_cmd = PARASITE_CMD_UNMAP;
@@ -1151,10 +1153,21 @@ int parasite_cure_remote(struct parasite_ctl *ctl)
args->parasite_start = (uintptr_t)ctl->remote_map;
args->parasite_len = ctl->map_length;
if (parasite_unmap(ctl, ctl->parasite_ip))
- ret = -1;
+ return -1;
+ } else {
+ unsigned long ret;
+
+ syscall_seized(ctl, __NR(munmap, !seized_native(ctl)), &ret,
+ (unsigned long)ctl->remote_map, ctl->map_length,
+ 0, 0, 0, 0);
+ if (ret) {
+ pr_err("munmap for remote map %p, %lu returned %lu\n",
+ ctl->remote_map, ctl->map_length, ret);
+ return -1;
+ }
}
- return ret;
+ return 0;
}
int parasite_cure_local(struct parasite_ctl *ctl)
--
2.9.0
More information about the CRIU
mailing list