rpms/kernel/devel linux-2.6-powerpc-FULL_REGS-on-exec.patch, NONE, 1.1 kernel.spec, 1.183, 1.184

Roland McGrath (roland) fedora-extras-commits at redhat.com
Tue Sep 25 00:08:23 UTC 2007


Author: roland

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv16733

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-powerpc-FULL_REGS-on-exec.patch 
Log Message:
Fix powerpc oops on ptrace after exec. (#301791)

linux-2.6-powerpc-FULL_REGS-on-exec.patch:

--- NEW FILE linux-2.6-powerpc-FULL_REGS-on-exec.patch ---
>From e3ca2dbae775573ae11243a57bcfd3337ec001a8 Mon Sep 17 00:00:00 2001
From: Roland McGrath <roland at redhat.com>
Date: Mon, 24 Sep 2007 16:46:40 -0700
Subject: [PATCH 2/2] powerpc: 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 at redhat.com>
---
 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..fd799d2 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;
-- 
1.5.2.4



Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.183
retrieving revision 1.184
diff -u -r1.183 -r1.184
--- kernel.spec	24 Sep 2007 21:55:27 -0000	1.183
+++ kernel.spec	25 Sep 2007 00:07:50 -0000	1.184
@@ -590,6 +590,7 @@
 Patch137: linux-2.6-powerpc-generic-suspend-4-kill-pmu-sleep-notifier.patch
 Patch138: linux-2.6-powerpc-generic-suspend-5-pmu-pm_ops.patch
 Patch140: linux-2.6-ppc-pegasos-via-ata-legacy-irq.patch
+Patch141: linux-2.6-powerpc-FULL_REGS-on-exec.patch
 
 Patch150: linux-2.6-build-nonintconfig.patch
 Patch160: linux-2.6-execshield.patch
@@ -672,7 +673,7 @@
 Patch1512: linux-2.6-firewire-multi-lun.patch
 Patch1515: linux-2.6-lirc.patch
 
-Patch1600: linux-2.6-x86-edd-maxdrive.patch 
+Patch1600: linux-2.6-x86-edd-maxdrive.patch
 
 #nouveau
 Patch1800: drm-mm-git.patch
@@ -1037,7 +1038,8 @@
 ApplyPatch linux-2.6-powerpc-generic-suspend-5-pmu-pm_ops.patch
 # pegasos IDE
 ApplyPatch linux-2.6-ppc-pegasos-via-ata-legacy-irq.patch
-
+# fix RHBZ#301791
+ApplyPatch linux-2.6-powerpc-FULL_REGS-on-exec.patch
 
 # Exec shield
 ApplyPatch linux-2.6-execshield.patch
@@ -1214,7 +1216,7 @@
 # ---------- below all scheduled for 2.6.23 -----------------
 
 # EDD fix
-ApplyPatch linux-2.6-x86-edd-maxdrive.patch 
+ApplyPatch linux-2.6-x86-edd-maxdrive.patch
 
 # END OF PATCH APPLICATIONS
 
@@ -1807,6 +1809,9 @@
 
 
 %changelog
+* Mon Sep 24 2007 Roland McGrath <roland at redhat.com>
+- Fix powerpc oops on ptrace after exec. (#301791)
+
 * Mon Sep 24 2007 Dave Jones <davej at redhat.com>
 - Disable generic RTC.
 




More information about the fedora-extras-commits mailing list