2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-01 14:55:39 +00:00

compel: Add ctx flags to get_task_regs()

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@arista.com>
This commit is contained in:
Dmitry Safonov
2018-02-07 12:48:49 +00:00
committed by Andrei Vagin
parent a80817a328
commit 70b67e3383
7 changed files with 14 additions and 8 deletions

View File

@@ -57,7 +57,8 @@ int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe,
return 0; 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; struct iovec iov;
user_fpregs_struct_t fpsimd; user_fpregs_struct_t fpsimd;

View File

@@ -66,7 +66,8 @@ int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe,
} }
#define PTRACE_GETVFPREGS 27 #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; user_fpregs_struct_t vfp;
int ret = -1; int ret = -1;

View File

@@ -371,7 +371,8 @@ static int __get_task_regs(pid_t pid, user_regs_struct_t *regs,
return 0; 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; user_fpregs_struct_t fpregs;
int ret; int ret;

View File

@@ -312,7 +312,7 @@ static int s390_disable_ri_bit(pid_t pid, user_regs_struct_t *regs)
* Prepare task registers for restart * Prepare task registers for restart
*/ */
int get_task_regs(pid_t pid, user_regs_struct_t *regs, save_regs_t save, 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; user_fpregs_struct_t fpregs;
struct iovec iov; struct iovec iov;

View File

@@ -225,7 +225,8 @@ int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe,
((user_regs_native(pregs)) ? (int64_t)((pregs)->native.name) : \ ((user_regs_native(pregs)) ? (int64_t)((pregs)->native.name) : \
(int32_t)((pregs)->compat.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; user_fpregs_struct_t xsave = { }, *xs = NULL;

View File

@@ -58,7 +58,8 @@ extern void *remote_mmap(struct parasite_ctl *ctl,
void *addr, size_t length, int prot, void *addr, size_t length, int prot,
int flags, int fd, off_t offset); int flags, int fd, off_t offset);
extern bool arch_can_dump_task(struct parasite_ctl *ctl); 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 arch_fetch_sas(struct parasite_ctl *ctl, struct rt_sigframe *s);
extern int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe, extern int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe,
user_regs_struct_t *regs, user_regs_struct_t *regs,

View File

@@ -667,7 +667,8 @@ static int parasite_start_daemon(struct parasite_ctl *ctl)
* while in daemon it is not such. * 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); pr_err("Can't obtain regs for thread %d\n", pid);
return -1; 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) 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) struct infect_ctx *compel_infect_ctx(struct parasite_ctl *ctl)