[kernel] r18242 - in dists/trunk/linux-2.6/debian: . patches/bugfix/powerpc patches/series

Ben Hutchings benh at alioth.debian.org
Fri Nov 11 01:45:05 UTC 2011


Author: benh
Date: Fri Nov 11 01:45:03 2011
New Revision: 18242

Log:
[powerpc] ptrace: Fix build with gcc 4.6

Added:
   dists/trunk/linux-2.6/debian/patches/bugfix/powerpc/powerpc-ptrace-Fix-build-with-gcc-4.6.patch
Modified:
   dists/trunk/linux-2.6/debian/changelog
   dists/trunk/linux-2.6/debian/patches/series/1~experimental.2

Modified: dists/trunk/linux-2.6/debian/changelog
==============================================================================
--- dists/trunk/linux-2.6/debian/changelog	Thu Nov 10 23:59:55 2011	(r18241)
+++ dists/trunk/linux-2.6/debian/changelog	Fri Nov 11 01:45:03 2011	(r18242)
@@ -3,6 +3,7 @@
   [ Ben Hutchings ]
   * [alpha] wire up accept4 syscall, thanks to Michael Cree
   * iwlagn: fix modinfo display for 135 ucode (Closes: #647958)
+  * [powerpc] ptrace: Fix build with gcc 4.6
 
  -- Ben Hutchings <ben at decadent.org.uk>  Fri, 04 Nov 2011 15:05:47 +0000
 

Added: dists/trunk/linux-2.6/debian/patches/bugfix/powerpc/powerpc-ptrace-Fix-build-with-gcc-4.6.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/trunk/linux-2.6/debian/patches/bugfix/powerpc/powerpc-ptrace-Fix-build-with-gcc-4.6.patch	Fri Nov 11 01:45:03 2011	(r18242)
@@ -0,0 +1,66 @@
+From: Benjamin Herrenschmidt <benh at kernel.crashing.org>
+Date: Mon, 26 Sep 2011 19:37:57 +0000
+Subject: [PATCH] powerpc/ptrace: Fix build with gcc 4.6
+
+commit e69b742a6793dc5bf16f6eedca534d4bc10d68b2 upstream.
+
+gcc (rightfully) complains that we are accessing beyond the
+end of the fpr array (we do, to access the fpscr).
+
+The only sane thing to do (whether anything in that code can be
+called remotely sane is debatable) is to special case fpscr and
+handle it as a separate statement.
+
+I initially tried to do it it by making the array access conditional
+to index < PT_FPSCR and using a 3rd else leg but for some reason gcc
+was unable to understand it and still spewed the warning.
+
+So I ended up with something a tad more intricated but it seems to
+build on 32-bit and on 64-bit with and without VSX.
+
+Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
+---
+ arch/powerpc/kernel/ptrace.c |   18 ++++++++++++++----
+ 1 files changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
+index 05b7dd2..18447c4 100644
+--- a/arch/powerpc/kernel/ptrace.c
++++ b/arch/powerpc/kernel/ptrace.c
+@@ -1497,9 +1497,14 @@ long arch_ptrace(struct task_struct *child, long request,
+ 		if (index < PT_FPR0) {
+ 			tmp = ptrace_get_reg(child, (int) index);
+ 		} else {
++			unsigned int fpidx = index - PT_FPR0;
++
+ 			flush_fp_to_thread(child);
+-			tmp = ((unsigned long *)child->thread.fpr)
+-				[TS_FPRWIDTH * (index - PT_FPR0)];
++			if (fpidx < (PT_FPSCR - PT_FPR0))
++				tmp = ((unsigned long *)child->thread.fpr)
++					[fpidx * TS_FPRWIDTH];
++			else
++				tmp = child->thread.fpscr.val;
+ 		}
+ 		ret = put_user(tmp, datalp);
+ 		break;
+@@ -1525,9 +1530,14 @@ long arch_ptrace(struct task_struct *child, long request,
+ 		if (index < PT_FPR0) {
+ 			ret = ptrace_put_reg(child, index, data);
+ 		} else {
++			unsigned int fpidx = index - PT_FPR0;
++
+ 			flush_fp_to_thread(child);
+-			((unsigned long *)child->thread.fpr)
+-				[TS_FPRWIDTH * (index - PT_FPR0)] = data;
++			if (fpidx < (PT_FPSCR - PT_FPR0))
++				((unsigned long *)child->thread.fpr)
++					[fpidx * TS_FPRWIDTH] = data;
++			else
++				child->thread.fpscr.val = data;
+ 			ret = 0;
+ 		}
+ 		break;
+-- 
+1.7.7.2
+

Modified: dists/trunk/linux-2.6/debian/patches/series/1~experimental.2
==============================================================================
--- dists/trunk/linux-2.6/debian/patches/series/1~experimental.2	Thu Nov 10 23:59:55 2011	(r18241)
+++ dists/trunk/linux-2.6/debian/patches/series/1~experimental.2	Fri Nov 11 01:45:03 2011	(r18242)
@@ -1,2 +1,3 @@
 + bugfix/alpha/alpha-wire-up-accept4-syscall.patch
 + bugfix/all/iwlagn-fix-modinfo-display-for-135-ucode.patch
++ bugfix/powerpc/powerpc-ptrace-Fix-build-with-gcc-4.6.patch



More information about the Kernel-svn-changes mailing list