[PATCH v2 21/28] um: Use struct uml_pt_regs for copy_context_skas0
benjamin at sipsolutions.net
benjamin at sipsolutions.net
Tue Nov 22 02:07:52 PST 2022
From: Benjamin Berg <benjamin at sipsolutions.net>
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 | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 1bc7e5aa2fc1..cdbab5a864e4 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -458,22 +458,21 @@ 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 +
- (unsigned long) stub_clone_handler -
- (unsigned long) __syscall_stub_start;
+ thread_regs.gp[REGS_IP_INDEX] = STUB_CODE +
+ (unsigned long)stub_clone_handler -
+ (unsigned long)__syscall_stub_start;
/* syscall data as a temporary stack area (top half). */
- thread_regs[REGS_SP_INDEX] = STUB_DATA +
- offsetof(struct stub_data, syscall_data) +
- sizeof(((struct stub_data *) 0)->syscall_data) -
- sizeof(void *);
+ thread_regs.gp[REGS_SP_INDEX] = STUB_DATA +
+ offsetof(struct stub_data, syscall_data) +
+ sizeof(((struct stub_data *)0)->syscall_data) -
+ sizeof(void *);
return 0;
}
@@ -502,7 +501,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",
@@ -510,7 +509,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.38.1
More information about the linux-um
mailing list