diff options
author | Roland McGrath <roland@redhat.com> | 2007-09-24 19:52:44 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-09-25 06:40:41 -0400 |
commit | 474f81967217f3bec2389ae913da72641f2c40e3 (patch) | |
tree | 8c9e16b05eeb0f56c49dcf61b145732569010ec8 /arch/powerpc | |
parent | 4942de4a0e914f205d351a81873f4f63986bcc3c (diff) |
[POWERPC] Ensure FULL_REGS on exec
When PTRACE_O_TRACEEXEC is used, a ptrace call to fetch the registers at
the PTRACE_EVENT_EXEC stop (PTRACE_PEEKUSR) will oops in CHECK_FULL_REGS.
With recent versions, "gdb --args /bin/sh -c 'exec /bin/true'" and "run" at
the (gdb) prompt is sufficient to produce this. I also have written an
isolated test case, see https://bugzilla.redhat.com/show_bug.cgi?id=301791#c15.
This change fixes the problem by clearing the low bit of pt_regs.trap in
start_thread so that FULL_REGS is true again. This is correct since all of
the GPRs that "full" refers to are cleared in start_thread.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/process.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index e477c9d0498b..8a1b001d0b11 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -605,6 +605,13 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp) | |||
605 | regs->ccr = 0; | 605 | regs->ccr = 0; |
606 | regs->gpr[1] = sp; | 606 | regs->gpr[1] = sp; |
607 | 607 | ||
608 | /* | ||
609 | * We have just cleared all the nonvolatile GPRs, so make | ||
610 | * FULL_REGS(regs) return true. This is necessary to allow | ||
611 | * ptrace to examine the thread immediately after exec. | ||
612 | */ | ||
613 | regs->trap &= ~1UL; | ||
614 | |||
608 | #ifdef CONFIG_PPC32 | 615 | #ifdef CONFIG_PPC32 |
609 | regs->mq = 0; | 616 | regs->mq = 0; |
610 | regs->nip = start; | 617 | regs->nip = start; |