[PATCH 20/27] um: Use struct uml_pt_regs for copy_context_skas0
Benjamin Berg
benjamin at sipsolutions.net
Wed Mar 3 15:55:16 GMT 2021
This is done as preparation for seccomp support as we have no helper to
copy the registers from a plain array.
Signed-off-by: Benjamin Berg <benjamin at sipsolutions.net>
---
arch/um/os-Linux/skas/process.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 660b23389016..3bfc28d28fc0 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -462,20 +462,19 @@ void userspace(struct uml_pt_regs *regs, unsigned long *aux_fp_regs)
}
}
-static unsigned long thread_regs[MAX_REG_NR];
-static unsigned long thread_fp_regs[FP_SIZE];
+static struct uml_pt_regs thread_regs;
static int __init init_thread_regs(void)
{
- get_safe_registers(thread_regs, thread_fp_regs);
+ get_safe_registers(thread_regs.gp, thread_regs.fp);
/* Set parent's instruction pointer to start of clone-stub */
- thread_regs[REGS_IP_INDEX] = STUB_CODE +
+ thread_regs.gp[REGS_IP_INDEX] = STUB_CODE +
(unsigned long) stub_clone_handler -
(unsigned long) __syscall_stub_start;
- thread_regs[REGS_SP_INDEX] = STUB_DATA + UM_KERN_PAGE_SIZE -
+ thread_regs.gp[REGS_SP_INDEX] = STUB_DATA + UM_KERN_PAGE_SIZE -
sizeof(void *);
#ifdef __SIGNAL_FRAMESIZE
- thread_regs[REGS_SP_INDEX] -= __SIGNAL_FRAMESIZE;
+ thread_regs.gp[REGS_SP_INDEX] -= __SIGNAL_FRAMESIZE;
#endif
return 0;
}
@@ -506,7 +505,7 @@ int copy_context_skas0(struct mm_id *id, struct mm_id *from)
.child_err = -ESRCH,
});
- err = ptrace_setregs(from->u.pid, thread_regs);
+ err = ptrace_setregs(from->u.pid, thread_regs.gp);
if (err < 0) {
err = -errno;
printk(UM_KERN_ERR "%s : PTRACE_SETREGS failed, pid = %d, errno = %d\n",
@@ -514,7 +513,7 @@ int copy_context_skas0(struct mm_id *id, struct mm_id *from)
return err;
}
- err = put_fp_registers(from->u.pid, thread_fp_regs);
+ err = put_fp_registers(from->u.pid, thread_regs.fp);
if (err < 0) {
printk(UM_KERN_ERR "%s : put_fp_registers failed, pid = %d, err = %d\n",
__func__, from->u.pid, err);
--
2.29.2
More information about the linux-um
mailing list