[CRIU] [PATCH 03/15] parasite: stop task on exit from a specified syscall
Andrey Vagin
avagin at openvz.org
Mon Sep 23 06:33:26 EDT 2013
This patch adds nothing new, just splits the existant function.
Currently a parasite stopped on sigreturn for unmaping a parasite blob.
The same scheme will be used for restorer blob and this function will be
used to stop on exit from the munmap syscall.
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
include/parasite-syscall.h | 1 +
parasite-syscall.c | 15 +++++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/include/parasite-syscall.h b/include/parasite-syscall.h
index aef5f69..1ae819a 100644
--- a/include/parasite-syscall.h
+++ b/include/parasite-syscall.h
@@ -114,4 +114,5 @@ extern bool arch_can_dump_task(pid_t pid);
extern int parasite_fixup_vdso(struct parasite_ctl *ctl, pid_t pid,
struct vm_area_list *vma_area_list);
+extern int parasite_stop_on_syscall(pid_t pid, int sys_nr);
#endif /* __CR_PARASITE_SYSCALL_H__ */
diff --git a/parasite-syscall.c b/parasite-syscall.c
index 00330ad..2f12cf0 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -759,6 +759,17 @@ static int parasite_fini_seized(struct parasite_ctl *ctl)
if (ret)
return -1;
+ if (parasite_stop_on_syscall(pid, __NR_rt_sigreturn))
+ return -1;
+
+ return 0;
+}
+
+int parasite_stop_on_syscall(pid_t pid, const int sys_nr)
+{
+ user_regs_struct_t regs;
+ int status, ret;
+
/* Stop all threads on the enter point in sys_rt_sigreturn */
while (1) {
if (wait4(pid, &status, __WALL, NULL) < 0) {
@@ -783,7 +794,7 @@ static int parasite_fini_seized(struct parasite_ctl *ctl)
}
pr_debug("%d is going to execute the syscall %lx\n", pid, REG_SYSCALL_NR(regs));
- if (REG_SYSCALL_NR(regs) == __NR_rt_sigreturn) {
+ if (REG_SYSCALL_NR(regs) == sys_nr) {
pr_debug("%d was stopped\n", pid);
break;
}
@@ -812,7 +823,7 @@ static int parasite_fini_seized(struct parasite_ctl *ctl)
return -1;
}
- return ret;
+ return 0;
}
int parasite_cure_remote(struct parasite_ctl *ctl)
--
1.8.3.1
More information about the CRIU
mailing list