aboutsummaryrefslogtreecommitdiff
path: root/arch/um/kernel
diff options
context:
space:
mode:
authorBenjamin Berg <[email protected]>2024-10-23 11:41:20 +0200
committerJohannes Berg <[email protected]>2024-10-23 12:13:16 +0200
commit3f17fed2149192c7d3b76a45a6a87b4ff22cd586 (patch)
tree6c76ac37c9db356076f5540230b84635a8b90efd /arch/um/kernel
parent0b8b2668f9981c1fefc2ef892bd915288ef01f33 (diff)
um: switch to regset API and depend on XSTATE
The PTRACE_GETREGSET API has now existed since Linux 2.6.33. The XSAVE CPU feature should also be sufficiently common to be able to rely on it. With this, define our internal FP state to be the hosts XSAVE data. Add discovery for the hosts XSAVE size and place the FP registers at the end of task_struct so that we can adjust the size at runtime. Next we can implement the regset API on top and update the signal handling as well as ptrace APIs to use them. Also switch coredump creation to use the regset API and finally set HAVE_ARCH_TRACEHOOK. This considerably improves the signal frames. Previously they might not have contained all the registers (i386) and also did not have the sizes and magic values set to the correct values to permit userspace to decode the frame. As a side effect, this will permit UML to run on hosts with newer CPU extensions (such as AMX) that need even more register state. Signed-off-by: Benjamin Berg <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
Diffstat (limited to 'arch/um/kernel')
-rw-r--r--arch/um/kernel/process.c22
-rw-r--r--arch/um/kernel/um_arch.c2
2 files changed, 9 insertions, 15 deletions
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index d45c79f82d7c..56e7e525fc91 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -187,6 +187,13 @@ void initial_thread_cb(void (*proc)(void *), void *arg)
kmalloc_ok = save_kmalloc_ok;
}
+int arch_dup_task_struct(struct task_struct *dst,
+ struct task_struct *src)
+{
+ memcpy(dst, src, arch_task_struct_size);
+ return 0;
+}
+
void um_idle_sleep(void)
{
if (time_travel_mode != TT_MODE_OFF)
@@ -287,18 +294,3 @@ unsigned long __get_wchan(struct task_struct *p)
return 0;
}
-
-int elf_core_copy_task_fpregs(struct task_struct *t, elf_fpregset_t *fpu)
-{
-#ifdef CONFIG_X86_32
- extern int have_fpx_regs;
-
- /* FIXME: A plain copy does not work on i386 with have_fpx_regs */
- if (have_fpx_regs)
- return 0;
-#endif
- memcpy(fpu, &t->thread.regs.regs.fp, sizeof(*fpu));
-
- return 1;
-}
-
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 6d755a37d5c4..ec17576ce9fc 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -402,6 +402,8 @@ int __init linux_main(int argc, char **argv, char **envp)
os_info("Kernel virtual memory size shrunk to %lu bytes\n",
virtmem_size);
+ arch_task_struct_size = sizeof(struct task_struct) + host_fp_size;
+
os_flush_stdout();
return start_uml();