Commit:     474f81967217f3bec2389ae913da72641f2c40e3
Parent:     4942de4a0e914f205d351a81873f4f63986bcc3c
Author:     Roland McGrath <[EMAIL PROTECTED]>
AuthorDate: Mon Sep 24 16:52:44 2007 -0700
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Tue Sep 25 20:40:41 2007 +1000

    [POWERPC] Ensure FULL_REGS on exec
    When PTRACE_O_TRACEEXEC is used, a ptrace call to fetch the registers at
    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
    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 <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
 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 e477c9d..8a1b001 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)
        regs->ccr = 0;
        regs->gpr[1] = sp;
+       /*
+        * We have just cleared all the nonvolatile GPRs, so make
+        * FULL_REGS(regs) return true.  This is necessary to allow
+        * ptrace to examine the thread immediately after exec.
+        */
+       regs->trap &= ~1UL;
 #ifdef CONFIG_PPC32
        regs->mq = 0;
        regs->nip = start;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to