[CRIU] [PATCHv2 4/9] compel: Add ctx flags to get_task_regs()
Dmitry Safonov
dima at arista.com
Wed Feb 7 15:48:49 MSK 2018
get_task_regs() needs to know if it needs to use workaround
for a Skylake ptrace() bug. The next patch will introduce a
new flag for that.
I also thought about making 3 versions of get_task_regs() and
adding them to ictx->get_task_regs() depending on the flags..
But get_task_regs() is a private function and infect_ctx is
a uapi.. So, let's just pass context flags to get_task_regs().
Signed-off-by: Dmitry Safonov <dima at arista.com>
---
compel/arch/aarch64/src/lib/infect.c | 3 ++-
compel/arch/arm/src/lib/infect.c | 3 ++-
compel/arch/ppc64/src/lib/infect.c | 3 ++-
compel/arch/s390/src/lib/infect.c | 2 +-
compel/arch/x86/src/lib/infect.c | 3 ++-
compel/include/infect-priv.h | 3 ++-
compel/src/lib/infect.c | 5 +++--
7 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/compel/arch/aarch64/src/lib/infect.c b/compel/arch/aarch64/src/lib/infect.c
index 74e72ad3908b..c4a2fde2052c 100644
--- a/compel/arch/aarch64/src/lib/infect.c
+++ b/compel/arch/aarch64/src/lib/infect.c
@@ -57,7 +57,8 @@ int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe,
return 0;
}
-int get_task_regs(pid_t pid, user_regs_struct_t *regs, save_regs_t save, void *arg)
+int get_task_regs(pid_t pid, user_regs_struct_t *regs, save_regs_t save,
+ void *arg, __maybe_unused unsigned long flags)
{
struct iovec iov;
user_fpregs_struct_t fpsimd;
diff --git a/compel/arch/arm/src/lib/infect.c b/compel/arch/arm/src/lib/infect.c
index c574d00e14b2..c17cb9c9b6e7 100644
--- a/compel/arch/arm/src/lib/infect.c
+++ b/compel/arch/arm/src/lib/infect.c
@@ -66,7 +66,8 @@ int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe,
}
#define PTRACE_GETVFPREGS 27
-int get_task_regs(pid_t pid, user_regs_struct_t *regs, save_regs_t save, void *arg)
+int get_task_regs(pid_t pid, user_regs_struct_t *regs, save_regs_t save,
+ void *arg, __maybe_unused unsigned long flags)
{
user_fpregs_struct_t vfp;
int ret = -1;
diff --git a/compel/arch/ppc64/src/lib/infect.c b/compel/arch/ppc64/src/lib/infect.c
index 1fa333e00754..96e1f3ba6994 100644
--- a/compel/arch/ppc64/src/lib/infect.c
+++ b/compel/arch/ppc64/src/lib/infect.c
@@ -371,7 +371,8 @@ static int __get_task_regs(pid_t pid, user_regs_struct_t *regs,
return 0;
}
-int get_task_regs(pid_t pid, user_regs_struct_t *regs, save_regs_t save, void *arg)
+int get_task_regs(pid_t pid, user_regs_struct_t *regs, save_regs_t save,
+ void *arg, __maybe_unused unsigned long flags)
{
user_fpregs_struct_t fpregs;
int ret;
diff --git a/compel/arch/s390/src/lib/infect.c b/compel/arch/s390/src/lib/infect.c
index abc1e6cd3fe3..940d0441858e 100644
--- a/compel/arch/s390/src/lib/infect.c
+++ b/compel/arch/s390/src/lib/infect.c
@@ -312,7 +312,7 @@ static int s390_disable_ri_bit(pid_t pid, user_regs_struct_t *regs)
* Prepare task registers for restart
*/
int get_task_regs(pid_t pid, user_regs_struct_t *regs, save_regs_t save,
- void *arg)
+ void *arg, __maybe_unused unsigned long flags)
{
user_fpregs_struct_t fpregs;
struct iovec iov;
diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c
index e546ee376d41..cdf4683397b0 100644
--- a/compel/arch/x86/src/lib/infect.c
+++ b/compel/arch/x86/src/lib/infect.c
@@ -225,7 +225,8 @@ int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe,
((user_regs_native(pregs)) ? (int64_t)((pregs)->native.name) : \
(int32_t)((pregs)->compat.name))
-int get_task_regs(pid_t pid, user_regs_struct_t *regs, save_regs_t save, void *arg)
+int get_task_regs(pid_t pid, user_regs_struct_t *regs, save_regs_t save,
+ void *arg, __maybe_unused unsigned long flags)
{
user_fpregs_struct_t xsave = { }, *xs = NULL;
diff --git a/compel/include/infect-priv.h b/compel/include/infect-priv.h
index 00671e71fed9..ec6dd455d1f6 100644
--- a/compel/include/infect-priv.h
+++ b/compel/include/infect-priv.h
@@ -58,7 +58,8 @@ extern void *remote_mmap(struct parasite_ctl *ctl,
void *addr, size_t length, int prot,
int flags, int fd, off_t offset);
extern bool arch_can_dump_task(struct parasite_ctl *ctl);
-extern int get_task_regs(pid_t pid, user_regs_struct_t *regs, save_regs_t save, void *arg);
+extern int get_task_regs(pid_t pid, user_regs_struct_t *regs, save_regs_t save,
+ void *arg, unsigned long flags);
extern int arch_fetch_sas(struct parasite_ctl *ctl, struct rt_sigframe *s);
extern int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe,
user_regs_struct_t *regs,
diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c
index 0527481edc3d..ecc6599b12d0 100644
--- a/compel/src/lib/infect.c
+++ b/compel/src/lib/infect.c
@@ -667,7 +667,8 @@ static int parasite_start_daemon(struct parasite_ctl *ctl)
* while in daemon it is not such.
*/
- if (get_task_regs(pid, &ctl->orig.regs, ictx->save_regs, ictx->regs_arg)) {
+ if (get_task_regs(pid, &ctl->orig.regs, ictx->save_regs,
+ ictx->regs_arg, ictx->flags)) {
pr_err("Can't obtain regs for thread %d\n", pid);
return -1;
}
@@ -1569,7 +1570,7 @@ k_rtsigset_t *compel_task_sigmask(struct parasite_ctl *ctl)
int compel_get_thread_regs(struct parasite_thread_ctl *tctl, save_regs_t save, void * arg)
{
- return get_task_regs(tctl->tid, &tctl->th.regs, save, arg);
+ return get_task_regs(tctl->tid, &tctl->th.regs, save, arg, tctl->ctl->ictx.flags);
}
struct infect_ctx *compel_infect_ctx(struct parasite_ctl *ctl)
--
2.13.6
More information about the CRIU
mailing list