Commit 86854297 authored by Paul Mackerras's avatar Paul Mackerras Committed by Linus Torvalds

[PATCH] Threaded core dumps for PPC32

At the moment, ppc32 kernels will oops if a threaded program tries to
dump core.  We call dump_fpu with a NULL regs pointer, which it tries
to dereference.

This fixes the issue by implementing the hooks used in doing threaded
core dumps properly.
parent dcf474f3
......@@ -45,7 +45,6 @@
#include <asm/prom.h>
#include <asm/hardirq.h>
int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs);
extern unsigned long _get_SP(void);
struct task_struct *last_task_used_math = NULL;
......@@ -189,11 +188,11 @@ enable_kernel_fp(void)
}
int
dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs)
dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs)
{
if (regs->msr & MSR_FP)
giveup_fpu(current);
memcpy(fpregs, &current->thread.fpr[0], sizeof(*fpregs));
if (tsk->thread.regs && tsk->thread.regs->msr & MSR_FP)
giveup_fpu(tsk);
memcpy(fpregs, &tsk->thread.fpr[0], sizeof(*fpregs));
return 1;
}
......
......@@ -91,10 +91,16 @@ typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
#define ELF_EXEC_PAGESIZE 4096
#define ELF_CORE_COPY_REGS(gregs, regs) \
memcpy(gregs, regs, \
sizeof(struct pt_regs) < sizeof(elf_gregset_t)? \
sizeof(struct pt_regs): sizeof(elf_gregset_t));
memcpy((gregs), (regs), sizeof(struct pt_regs)); \
memset((char *)(gregs) + sizeof(struct pt_regs), 0, \
sizeof(elf_gregset_t) - sizeof(struct pt_regs));
#define ELF_CORE_COPY_TASK_REGS(t, elfregs) \
((t)->thread.regs? \
({ ELF_CORE_COPY_REGS((elfregs), (t)->thread.regs); 1; }): 0)
extern int dump_task_fpu(struct task_struct *t, elf_fpregset_t *fpu);
#define ELF_CORE_COPY_FPREGS(t, fpu) dump_task_fpu((t), (fpu))
/* This yields a mask that user programs can use to figure out what
instruction set this cpu supports. This could be done in userspace,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment