Messages in this thread Patch in this message | | | Date | Wed, 24 Mar 2004 22:50:39 +1100 | From | Paul Mackerras <> | Subject | [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 patch fixes that by implementing the hooks used in doing threaded core dumps properly.
Please apply, preferably before 2.6.5 (since it fixes an oops).
Thanks, Paul.
diff -urN linux-2.5/arch/ppc/kernel/process.c pmac-2.5/arch/ppc/kernel/process.c --- linux-2.5/arch/ppc/kernel/process.c 2003-10-14 19:41:13.000000000 +1000 +++ pmac-2.5/arch/ppc/kernel/process.c 2004-03-24 12:55:33.000000000 +1100 @@ -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 @@ } 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, ¤t->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; } diff -urN linux-2.5/include/asm-ppc/elf.h pmac-2.5/include/asm-ppc/elf.h --- linux-2.5/include/asm-ppc/elf.h 2003-05-13 11:47:15.000000000 +1000 +++ pmac-2.5/include/asm-ppc/elf.h 2004-03-24 13:49:17.000000000 +1100 @@ -90,11 +90,17 @@ #define USE_ELF_CORE_DUMP #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)); +#define ELF_CORE_COPY_REGS(gregs, regs) \ + 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, - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |