mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 01:51:51 +00:00
compel: always pass user_fpregs_struct_t to compel_get_task_regs()
All architectures create on-stack structure for floating point save area in compel_get_task_regs() if the caller passes NULL rather than a valid pointer. The only place that calls compel_get_task_regs() with NULL for floating point save area is parasite_start_daemon() and it is simpler to define this strucuture on stack of parasite_start_daemon(). The availability of floating point save data is required in parasite_start_daemon() to detect shadow stack presence early during parasite infection and will be used in later patches. Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
This commit is contained in:
parent
0b8c51eaad
commit
17f4dd0959
@ -59,10 +59,9 @@ int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe, struct rt_sigfr
|
||||
return 0;
|
||||
}
|
||||
|
||||
int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *ext_regs, save_regs_t save,
|
||||
int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *fpsimd, save_regs_t save,
|
||||
void *arg, __maybe_unused unsigned long flags)
|
||||
{
|
||||
user_fpregs_struct_t tmp, *fpsimd = ext_regs ? ext_regs : &tmp;
|
||||
struct iovec iov;
|
||||
int ret;
|
||||
|
||||
|
@ -65,10 +65,9 @@ int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe, struct rt_sigfr
|
||||
}
|
||||
|
||||
#define PTRACE_GETVFPREGS 27
|
||||
int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *ext_regs, save_regs_t save,
|
||||
int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *vfp, save_regs_t save,
|
||||
void *arg, __maybe_unused unsigned long flags)
|
||||
{
|
||||
user_fpregs_struct_t tmp, *vfp = ext_regs ? ext_regs : &tmp;
|
||||
int ret = -1;
|
||||
|
||||
pr_info("Dumping GP/FPU registers for %d\n", pid);
|
||||
|
@ -119,10 +119,9 @@ int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe, struct rt_sigfr
|
||||
return 0;
|
||||
}
|
||||
|
||||
int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *ext_regs, save_regs_t save,
|
||||
int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *xs, save_regs_t save,
|
||||
void *arg, __maybe_unused unsigned long flags)
|
||||
{
|
||||
user_fpregs_struct_t xsave = {}, *xs = ext_regs ? ext_regs : &xsave;
|
||||
int ret = -1;
|
||||
|
||||
pr_info("Dumping GP/FPU registers for %d\n", pid);
|
||||
|
@ -391,10 +391,9 @@ static int __get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_stru
|
||||
return 0;
|
||||
}
|
||||
|
||||
int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *ext_regs, save_regs_t save,
|
||||
int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *fpregs, save_regs_t save,
|
||||
void *arg, __maybe_unused unsigned long flags)
|
||||
{
|
||||
user_fpregs_struct_t tmp, *fpregs = ext_regs ? ext_regs : &tmp;
|
||||
int ret;
|
||||
|
||||
ret = __get_task_regs(pid, regs, fpregs);
|
||||
|
@ -293,10 +293,9 @@ static int s390_disable_ri_bit(pid_t pid, user_regs_struct_t *regs)
|
||||
/*
|
||||
* Prepare task registers for restart
|
||||
*/
|
||||
int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *ext_regs, save_regs_t save,
|
||||
int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *fpregs, save_regs_t save,
|
||||
void *arg, __maybe_unused unsigned long flags)
|
||||
{
|
||||
user_fpregs_struct_t tmp, *fpregs = ext_regs ? ext_regs : &tmp;
|
||||
struct iovec iov;
|
||||
int rewind;
|
||||
|
||||
|
@ -345,10 +345,9 @@ static int corrupt_extregs(pid_t pid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *ext_regs, save_regs_t save,
|
||||
int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *xs, save_regs_t save,
|
||||
void *arg, unsigned long flags)
|
||||
{
|
||||
user_fpregs_struct_t xsave = {}, *xs = ext_regs ? ext_regs : &xsave;
|
||||
int ret = -1;
|
||||
|
||||
pr_info("Dumping general registers for %d in %s mode\n", pid, user_regs_native(regs) ? "native" : "compat");
|
||||
|
@ -739,6 +739,7 @@ static int parasite_start_daemon(struct parasite_ctl *ctl)
|
||||
{
|
||||
pid_t pid = ctl->rpid;
|
||||
struct infect_ctx *ictx = &ctl->ictx;
|
||||
user_fpregs_struct_t ext_regs;
|
||||
|
||||
/*
|
||||
* Get task registers before going daemon, since the
|
||||
@ -746,7 +747,7 @@ static int parasite_start_daemon(struct parasite_ctl *ctl)
|
||||
* while in daemon it is not such.
|
||||
*/
|
||||
|
||||
if (compel_get_task_regs(pid, &ctl->orig.regs, NULL, ictx->save_regs, ictx->regs_arg, ictx->flags)) {
|
||||
if (compel_get_task_regs(pid, &ctl->orig.regs, &ext_regs, ictx->save_regs, ictx->regs_arg, ictx->flags)) {
|
||||
pr_err("Can't obtain regs for thread %d\n", pid);
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user