uml: fix x86_64 core dump crash
Stop UML crashing when trying to dump a process core on x86_64. This is the minimal fix to stop the crash - more things are broken here, and patches are forthcoming. The immediate thing to do is define ELF_CORE_COPY_REGS and ELF_CORE_COPY_FPREGS. Defining ELF_CORE_COPY_FPREGS allows dump_fpu to go away. It is defined in terms of save_fp_registers, so that needs to be added. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
c7ec16da5a
commit
d1254b12c9
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <string.h>
|
||||
#include "ptrace_user.h"
|
||||
#include "uml-config.h"
|
||||
@@ -17,6 +18,20 @@
|
||||
static unsigned long exec_regs[MAX_REG_NR];
|
||||
static unsigned long exec_fp_regs[HOST_FP_SIZE];
|
||||
|
||||
int save_fp_registers(int pid, unsigned long *fp_regs)
|
||||
{
|
||||
if(ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int restore_fp_registers(int pid, unsigned long *fp_regs)
|
||||
{
|
||||
if(ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void init_thread_registers(union uml_pt_regs *to)
|
||||
{
|
||||
memcpy(to->skas.regs, exec_regs, sizeof(to->skas.regs));
|
||||
|
Reference in New Issue
Block a user