[CRIU] [PATCH 10/21] dump: update task registers if a signal is started handling
Andrey Vagin
avagin at openvz.org
Fri May 24 08:20:13 EDT 2013
When we try to execute a parasite code, a signal can be started
handling, so we need to update a task registers, which will be saved in
a core file.
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
arch/arm/crtools.c | 3 ++-
arch/x86/crtools.c | 3 ++-
include/parasite-syscall.h | 4 +++-
parasite-syscall.c | 8 +++++---
4 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/arch/arm/crtools.c b/arch/arm/crtools.c
index a07251b..e06f03c 100644
--- a/arch/arm/crtools.c
+++ b/arch/arm/crtools.c
@@ -76,7 +76,8 @@ int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
regs.ARM_r5 = arg6;
parasite_setup_regs(ctl->syscall_ip, 0, ®s);
- err = __parasite_execute_trap(ctl, ctl->pid.real, ®s);
+ err = __parasite_execute_trap(ctl, ctl->pid.real, ®s,
+ &ctl->threads[0].regs_orig);
if (err)
return err;
diff --git a/arch/x86/crtools.c b/arch/x86/crtools.c
index 3bed43a..b5a0858 100644
--- a/arch/x86/crtools.c
+++ b/arch/x86/crtools.c
@@ -100,7 +100,8 @@ int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
regs.r9 = arg6;
parasite_setup_regs(ctl->syscall_ip, 0, ®s);
- err = __parasite_execute_trap(ctl, ctl->pid.real, ®s);
+ err = __parasite_execute_trap(ctl, ctl->pid.real, ®s,
+ &ctl->threads[0].regs_orig);
if (err)
return err;
diff --git a/include/parasite-syscall.h b/include/parasite-syscall.h
index dab8ddf..c736289 100644
--- a/include/parasite-syscall.h
+++ b/include/parasite-syscall.h
@@ -101,6 +101,8 @@ int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
unsigned long arg6);
extern bool arch_can_dump_task(pid_t pid);
-extern int __parasite_execute_trap(struct parasite_ctl *ctl, pid_t pid, user_regs_struct_t *regs);
+extern int __parasite_execute_trap(struct parasite_ctl *ctl, pid_t pid,
+ user_regs_struct_t *regs,
+ user_regs_struct_t *regs_orig);
#endif /* __CR_PARASITE_SYSCALL_H__ */
diff --git a/parasite-syscall.c b/parasite-syscall.c
index 6ba4fb4..490082d 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -61,7 +61,9 @@ static struct vma_area *get_vma_by_ip(struct list_head *vma_area_list, unsigned
}
/* we run at @regs->ip */
-int __parasite_execute_trap(struct parasite_ctl *ctl, pid_t pid, user_regs_struct_t *regs)
+int __parasite_execute_trap(struct parasite_ctl *ctl, pid_t pid,
+ user_regs_struct_t *regs,
+ user_regs_struct_t *regs_orig)
{
siginfo_t siginfo;
int status;
@@ -169,7 +171,7 @@ retry_signal:
pr_perror("Can't obtain registers (pid: %d)", pid);
goto err;
}
- ctl->threads[0].regs_orig = r;
+ *regs_orig = r;
}
goto again;
@@ -206,7 +208,7 @@ static int parasite_execute_trap_by_id(unsigned int cmd, struct parasite_ctl *ct
parasite_setup_regs(ctl->parasite_ip, thread->rstack, ®s);
- ret = __parasite_execute_trap(ctl, pid, ®s);
+ ret = __parasite_execute_trap(ctl, pid, ®s, &thread->regs_orig);
if (ret == 0)
ret = (int)REG_RES(regs);
--
1.8.2
More information about the CRIU
mailing list