rpms/kernel/F-7 linux-2.6-sched-disable-precise-accounting.patch, NONE, 1.1 kernel-2.6.spec, 1.3373, 1.3374 linux-2.6-utrace-ptrace-compat.patch, 1.6, 1.7 linux-2.6-utrace-regset.patch, 1.6, 1.7

Chuck Ebbert (cebbert) fedora-extras-commits at redhat.com
Fri Nov 9 20:01:41 UTC 2007


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22658

Modified Files:
	kernel-2.6.spec linux-2.6-utrace-ptrace-compat.patch 
	linux-2.6-utrace-regset.patch 
Added Files:
	linux-2.6-sched-disable-precise-accounting.patch 
Log Message:
* Fri Nov 09 2007 Chuck Ebbert <cebbert at redhat.com>
- Update utrace, fixing some powerpc bugs.
- Disable precise scheduler CPU accounting (#340161).


linux-2.6-sched-disable-precise-accounting.patch:

--- NEW FILE linux-2.6-sched-disable-precise-accounting.patch ---
---
 kernel/sched_fair.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.23.noarch.orig/kernel/sched_fair.c
+++ linux-2.6.23.noarch/kernel/sched_fair.c
@@ -93,7 +93,7 @@ unsigned int sysctl_sched_features __rea
 		SCHED_FEAT_FAIR_SLEEPERS	*1 |
 		SCHED_FEAT_SLEEPER_AVG		*0 |
 		SCHED_FEAT_SLEEPER_LOAD_AVG	*1 |
-		SCHED_FEAT_PRECISE_CPU_LOAD	*1 |
+		SCHED_FEAT_PRECISE_CPU_LOAD	*0 |
 		SCHED_FEAT_START_DEBIT		*1 |
 		SCHED_FEAT_SKIP_INITIAL		*0;
 


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-7/kernel-2.6.spec,v
retrieving revision 1.3373
retrieving revision 1.3374
diff -u -r1.3373 -r1.3374
--- kernel-2.6.spec	6 Nov 2007 01:05:12 -0000	1.3373
+++ kernel-2.6.spec	9 Nov 2007 20:00:59 -0000	1.3374
@@ -646,6 +646,7 @@
 Patch1500: linux-2.6-pmtrace-time-fix.patch
 Patch1510: linux-2.6-sched-keep-stime-monotonic.patch
 Patch1511: linux-2.6-sched-keep-utime-monotonic.patch
+Patch1512: linux-2.6-sched-disable-precise-accounting.patch
 
 Patch1600: linux-2.6-params-sysfs-skip-missing-period.patch
 
@@ -1352,6 +1353,8 @@
 # fix "top shows 9999% CPU usage"
 ApplyPatch linux-2.6-sched-keep-utime-monotonic.patch
 ApplyPatch linux-2.6-sched-keep-stime-monotonic.patch
+# prevent divide-by-zero in scheduler code
+ApplyPatch linux-2.6-sched-disable-precise-accounting.patch
 
 # fix weird file in /sys/module/nousb
 ApplyPatch linux-2.6-params-sysfs-skip-missing-period.patch
@@ -2278,6 +2281,10 @@
 %endif
 
 %changelog
+* Fri Nov 09 2007 Chuck Ebbert <cebbert at redhat.com>
+- Update utrace, fixing some powerpc bugs.
+- Disable precise scheduler CPU accounting (#340161).
+
 * Tue Nov 06 2007 Dave Airlie <airlied at linux.ie>
 - copy drm fixes from Fedora 8 (bug 228414) + i915 allocation
 

linux-2.6-utrace-ptrace-compat.patch:

Index: linux-2.6-utrace-ptrace-compat.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-7/linux-2.6-utrace-ptrace-compat.patch,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- linux-2.6-utrace-ptrace-compat.patch	10 Oct 2007 21:22:57 -0000	1.6
+++ linux-2.6-utrace-ptrace-compat.patch	9 Nov 2007 20:00:59 -0000	1.7
@@ -14,17 +14,17 @@
 
  fs/proc/base.c                  |   40 +
  arch/i386/kernel/ptrace.c       |   40 +
- arch/x86_64/ia32/ptrace32.c     |   56 +
+ arch/x86_64/ia32/ptrace32.c     |   57 +
  arch/x86_64/ia32/ia32entry.S    |    2 
  arch/x86_64/kernel/ptrace.c     |   46 +
- arch/powerpc/kernel/ptrace.c    |  452 +++++----
+ arch/powerpc/kernel/ptrace.c    |  455 +++++----
  arch/powerpc/kernel/signal_32.c |   52 +
  arch/powerpc/kernel/Makefile    |    2 
  arch/powerpc/kernel/ptrace32.c  |  408 --------
  arch/powerpc/lib/sstep.c        |    3 
  kernel/fork.c                   |    2 
  kernel/exit.c                   |   13 
- kernel/ptrace.c                 | 2056 +++++++++++++++++++++++++++++++++++++--
+ kernel/ptrace.c                 | 2058 +++++++++++++++++++++++++++++++++++++--
  kernel/sys_ni.c                 |    4 
  kernel/Makefile                 |    3 
  include/linux/sched.h           |    4 
@@ -32,7 +32,7 @@
  include/asm-x86_64/tracehook.h  |    1 
  include/asm-x86_64/ptrace-abi.h |    3 
  init/Kconfig                    |   15 
- 20 files changed, 2643 insertions(+), 780 deletions(-)
+ 20 files changed, 2650 insertions(+), 779 deletions(-)
  delete arch/powerpc/kernel/ptrace32.c
 
 --- linux-2.6/fs/proc/base.c
@@ -124,7 +124,7 @@
 +	case PTRACE_SET_THREAD_AREA:
 +		return ptrace_onereg_access(child, engine,
 +					    utrace_native_view(current), 3,
-+					    addr, (void __user *)data,
++					    addr, (void __user *)data, NULL,
 +					    *req == PTRACE_SET_THREAD_AREA);
 +	}
 +	return -ENOSYS;
@@ -147,7 +147,7 @@
  static int
  ia32_genregs_get(struct task_struct *target,
  		 const struct utrace_regset *regset,
-@@ -604,3 +599,54 @@ const struct utrace_regset_view utrace_i
+@@ -604,3 +599,55 @@ const struct utrace_regset_view utrace_i
  	.name = "i386", .e_machine = EM_386,
  	.regsets = ia32_regsets, .n = ARRAY_SIZE(ia32_regsets)
  };
@@ -197,6 +197,7 @@
 +					    &utrace_ia32_view, 3,
 +					    addr,
 +					    (void __user *)(unsigned long)data,
++					    NULL,
 +					    *req == PTRACE_SET_THREAD_AREA);
 +	}
 +	return -ENOSYS;
@@ -251,7 +252,7 @@
 +	case PTRACE_SET_THREAD_AREA:
 +		return ptrace_onereg_access(child, engine,
 +					    &utrace_ia32_view, 3,
-+					    addr, (void __user *)data,
++					    addr, (void __user *)data, NULL,
 +					    *req == PTRACE_SET_THREAD_AREA);
 +#endif
 +		/* normal 64bit interface to access TLS data.
@@ -270,7 +271,7 @@
  	/* do the secure computing check first */
 --- linux-2.6/arch/powerpc/kernel/ptrace.c
 +++ linux-2.6/arch/powerpc/kernel/ptrace.c
-@@ -564,249 +564,315 @@ const struct utrace_regset_view *utrace_
+@@ -590,249 +590,320 @@ const struct utrace_regset_view *utrace_
  }
  
  
@@ -301,35 +302,6 @@
 -			tmp++;
 -		}
 -		break;
--	}
--
--	case PPC_PTRACE_SETREGS: { /* Set GPRs 0 - 31. */
--		int i;
--		unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
--		unsigned long __user *tmp = (unsigned long __user *)addr;
--
--		for (i = 0; i < 32; i++) {
--			ret = get_user(*reg, tmp);
--			if (ret)
--				break;
--			reg++;
--			tmp++;
--		}
--		break;
--	}
--
--	case PPC_PTRACE_GETFPREGS: { /* Get FPRs 0 - 31. */
--		flush_fp_to_thread(child);
--/*		ret = get_fpregs((void __user *)addr, child, 0);*/
--		break;
--	}
--
--	case PPC_PTRACE_SETFPREGS: { /* Get FPRs 0 - 31. */
--		flush_fp_to_thread(child);
--/*		ret = set_fpregs((void __user *)addr, child, 0);*/
--		break;
--	}
--
 +	switch (*request) {
 +	case PPC_PTRACE_GETREGS: /* Get GPRs 0 - 31. */
 +	case PPC_PTRACE_SETREGS: /* Set GPRs 0 - 31. */
@@ -346,11 +318,23 @@
 +					    (void __user *)addr,
 +					    *request == PPC_PTRACE_SETFPREGS);
  	}
--	return ret;
 +	return -ENOSYS;
- }
++}
  
--long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+-	case PPC_PTRACE_SETREGS: { /* Set GPRs 0 - 31. */
+-		int i;
+-		unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
+-		unsigned long __user *tmp = (unsigned long __user *)addr;
+-
+-		for (i = 0; i < 32; i++) {
+-			ret = get_user(*reg, tmp);
+-			if (ret)
+-				break;
+-			reg++;
+-			tmp++;
+-		}
+-		break;
+-	}
 +static const struct ptrace_layout_segment ppc_uarea[] = {
 +	{0, PT_FPR0 * sizeof(long), 0, 0},
 +	{PT_FPR0 * sizeof(long), (PT_FPSCR + 1) * sizeof(long), 1, 0},
@@ -360,30 +344,28 @@
 +int arch_ptrace(long *request, struct task_struct *child,
 +		struct utrace_attached_engine *engine,
 +		unsigned long addr, unsigned long data, long *val)
- {
--	int ret = -EPERM;
++{
 +	switch (*request) {
 +	case PTRACE_PEEKUSR:
 +		return ptrace_peekusr(child, engine, ppc_uarea, addr, data);
 +	case PTRACE_POKEUSR:
 +		return ptrace_pokeusr(child, engine, ppc_uarea, addr, data);
- 
--	switch (request) {
--	/* when I and D space are separate, these will need to be fixed. */
--	case PTRACE_PEEKTEXT: /* read word at location addr. */
--	case PTRACE_PEEKDATA:
--		ret = generic_ptrace_peekdata(child, addr, data);
--		break;
++
 +	case PTRACE_GET_DEBUGREG:
-+	case PTRACE_SET_DEBUGREG:
 +		return ptrace_onereg_access(child, engine,
 +					    utrace_native_view(current), 3,
 +					    addr, (unsigned long __user *)data,
-+					    *request == PTRACE_SET_DEBUGREG);
++					    NULL, 0);
++	case PTRACE_SET_DEBUGREG:
++		return ptrace_onereg_access(child, engine,
++					    utrace_native_view(current), 3,
++					    addr, NULL, &data, 1);
  
--	/* read the word at location addr in the USER area. */
--	case PTRACE_PEEKUSR: {
--		unsigned long index, tmp;
+-	case PPC_PTRACE_GETFPREGS: { /* Get FPRs 0 - 31. */
+-		flush_fp_to_thread(child);
+-/*		ret = get_fpregs((void __user *)addr, child, 0);*/
+-		break;
+-	}
 +#ifdef CONFIG_PPC64
 +	case PTRACE_GETREGS64:
 +	case PTRACE_SETREGS64:
@@ -397,7 +379,7 @@
 +		return ptrace_regset_access(child, engine,
 +					    &utrace_ppc_native_view, 0,
 +					    0, sizeof(struct pt_regs),
-+					    (void __user *)addr,
++					    (struct pt_regs __user *)data,
 +					    *request == PTRACE_SETREGS ||
 +					    *request == PTRACE_SETREGS64);
 +
@@ -406,12 +388,11 @@
 +	case PTRACE_SETFPREGS:
 +		return ptrace_whole_regset(child, engine, data, 1, 1);
  
--		ret = -EIO;
--		/* convert to index and check */
--#ifdef CONFIG_PPC32
--		index = (unsigned long) addr >> 2;
--		if ((addr & 3) || (index > PT_FPSCR)
--		    || (child->thread.regs == NULL))
+-	case PPC_PTRACE_SETFPREGS: { /* Get FPRs 0 - 31. */
+-		flush_fp_to_thread(child);
+-/*		ret = set_fpregs((void __user *)addr, child, 0);*/
+-		break;
+-	}
 +#ifdef CONFIG_ALTIVEC
 +	case PTRACE_GETVRREGS:
 +		return ptrace_whole_regset(child, engine, data, 2, 0);
@@ -421,27 +402,15 @@
 +#ifdef CONFIG_SPE
 +#ifdef CONFIG_ALTIVEC
 +#define REGSET_EVR 3
- #else
--		index = (unsigned long) addr >> 3;
--		if ((addr & 7) || (index > PT_FPSCR))
++#else
 +#define REGSET_EVR 2
 +#endif
 +	case PTRACE_GETEVRREGS:
 +		return ptrace_whole_regset(child, engine, data, REGSET_EVR, 0);
 +	case PTRACE_SETEVRREGS:
 +		return ptrace_whole_regset(child, engine, data, REGSET_EVR, 1);
- #endif
--			break;
++#endif
  
--		CHECK_FULL_REGS(child->thread.regs);
--		if (index < PT_FPR0) {
--			tmp = 0;/*ptrace_get_reg(child, (int) index);*/
--		} else {
--			flush_fp_to_thread(child);
--			tmp = ((unsigned long *)child->thread.fpr)[index - PT_FPR0];
--		}
--		ret = put_user(tmp,(unsigned long __user *) data);
--		break;
 +	/* Old reverse args ptrace callss */
 +	case PPC_PTRACE_GETREGS: /* Get GPRs 0 - 31. */
 +	case PPC_PTRACE_SETREGS: /* Set GPRs 0 - 31. */
@@ -449,18 +418,12 @@
 +	case PPC_PTRACE_SETFPREGS: /* Get FPRs 0 - 31. */
 +		return arch_ptrace_old(request, child, engine, addr, data, val);
  	}
- 
--	/* If I and D space are separate, this will have to be fixed. */
--	case PTRACE_POKETEXT: /* write the word at location addr. */
--	case PTRACE_POKEDATA:
--		ret = generic_ptrace_pokedata(child, addr, data);
--		break;
+-	return ret;
++
 +	return -ENOSYS;
-+}
+ }
  
--	/* write the word at location addr in the USER area */
--	case PTRACE_POKEUSR: {
--		unsigned long index;
+-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 +#ifdef CONFIG_PPC64
 +/*
 + * Here are the old "legacy" powerpc specific getregs/setregs ptrace calls,
@@ -471,7 +434,8 @@
 +			     struct utrace_attached_engine *engine,
 +			     compat_ulong_t addr, compat_ulong_t data,
 +			     compat_long_t *val)
-+{
+ {
+-	int ret = -EPERM;
 +	void __user *uaddr = (void __user *) (unsigned long) addr;
 +	switch (*request) {
 +	case PPC_PTRACE_GETREGS: /* Get GPRs 0 - 31. */
@@ -484,7 +448,13 @@
 +	}
 +	return -ENOSYS;
 +}
-+
+ 
+-	switch (request) {
+-	/* when I and D space are separate, these will need to be fixed. */
+-	case PTRACE_PEEKTEXT: /* read word at location addr. */
+-	case PTRACE_PEEKDATA:
+-		ret = generic_ptrace_peekdata(child, addr, data);
+-		break;
 +static const struct ptrace_layout_segment ppc32_uarea[] = {
 +	{0, PT_FPR0 * sizeof(u32), 0, 0},
 +	{PT_FPR0 * sizeof(u32), (PT_FPSCR32 + 1) * sizeof(u32), 1, 0},
@@ -498,9 +468,11 @@
 +		       compat_long_t *val)
 +{
 +	long lrequest = *request;
-+	void __user *uaddr = (void __user *) (unsigned long) addr;
 +	int ret = -ENOSYS;
-+
+ 
+-	/* read the word at location addr in the USER area. */
+-	case PTRACE_PEEKUSR: {
+-		unsigned long index, tmp;
 +	switch (*request) {
 +	case PTRACE_PEEKUSR:
 +		return ptrace_compat_peekusr(child, engine, ppc32_uarea,
@@ -534,40 +506,37 @@
 -		index = (unsigned long) addr >> 3;
 -		if ((addr & 7) || (index > PT_FPSCR))
 -#endif
--			break;
++
++		/* Get the addr in the other process that we want to read */
++		if (get_user(addrOthers, ((u32 __user * __user *)
++					  (unsigned long) addr)) != 0)
+ 			break;
  
 -		CHECK_FULL_REGS(child->thread.regs);
 -		if (index < PT_FPR0) {
--/*			ret = ptrace_put_reg(child, index, data);*/
+-			tmp = 0;/*ptrace_get_reg(child, (int) index);*/
 -		} else {
 -			flush_fp_to_thread(child);
--			((unsigned long *)child->thread.fpr)[index - PT_FPR0] = data;
--			ret = 0;
+-			tmp = ((unsigned long *)child->thread.fpr)[index - PT_FPR0];
 -		}
--		break;
--	}
-+		/* Get the addr in the other process that we want to read */
-+		if (get_user(addrOthers, ((u32 __user * __user *)
-+					  (unsigned long) addr)) != 0)
-+			break;
- 
--	case PTRACE_GET_DEBUGREG: {
--		ret = -EINVAL;
--		/* We only support one DABR and no IABRS at the moment */
--		if (addr > 0)
+-		ret = put_user(tmp,(unsigned long __user *) data);
 +		copied = access_process_vm(child, (u64)addrOthers, &tmp,
 +				sizeof(tmp), 0);
 +		if (copied != sizeof(tmp))
- 			break;
--		ret = put_user(child->thread.dabr,
--			       (unsigned long __user *)data);
++			break;
 +		ret = put_user(tmp, (u32 __user *)(unsigned long)data);
  		break;
  	}
  
--	case PTRACE_SET_DEBUGREG:
--/*		ret = ptrace_set_debugreg(child, addr, data);*/
+-	/* If I and D space are separate, this will have to be fixed. */
+-	case PTRACE_POKETEXT: /* write the word at location addr. */
+-	case PTRACE_POKEDATA:
+-		ret = generic_ptrace_pokedata(child, addr, data);
 -		break;
+-
+-	/* write the word at location addr in the USER area */
+-	case PTRACE_POKEUSR: {
+-		unsigned long index;
 +	/*
 +	 * Write 4 bytes into the other process' storage
 +	 *  data is the 4 bytes that the user wants written
@@ -582,46 +551,53 @@
 +		u32 tmp = data;
 +		u32 __user * addrOthers;
  
--	case PTRACE_DETACH:
--		ret = ptrace_detach(child, data);
--		break;
--
--#ifdef CONFIG_PPC64
--	case PTRACE_GETREGS64:
--#endif
--	case PTRACE_GETREGS: { /* Get all pt_regs from the child. */
--		int ui;
--	  	if (!access_ok(VERIFY_WRITE, (void __user *)data,
--			       sizeof(struct pt_regs))) {
--			ret = -EIO;
 +		/* Get the addr in the other process that we want to write into */
-+		ret = -EIO;
+ 		ret = -EIO;
+-		/* convert to index and check */
+-#ifdef CONFIG_PPC32
+-		index = (unsigned long) addr >> 2;
+-		if ((addr & 3) || (index > PT_FPSCR)
+-		    || (child->thread.regs == NULL))
+-#else
+-		index = (unsigned long) addr >> 3;
+-		if ((addr & 7) || (index > PT_FPSCR))
+-#endif
 +		if (get_user(addrOthers, ((u32 __user * __user *)
 +					  (unsigned long) addr)) != 0)
  			break;
+-
+-		CHECK_FULL_REGS(child->thread.regs);
+-		if (index < PT_FPR0) {
+-/*			ret = ptrace_put_reg(child, index, data);*/
+-		} else {
+-			flush_fp_to_thread(child);
+-			((unsigned long *)child->thread.fpr)[index - PT_FPR0] = data;
+-			ret = 0;
 -		}
- 		ret = 0;
--		for (ui = 0; ui < PT_REGS_COUNT; ui ++) {
--/*			ret |= __put_user(ptrace_get_reg(child, ui),
--					  (unsigned long __user *) data);*/
--			data += sizeof(long);
--		}
+-		break;
+-	}
+-
+-	case PTRACE_GET_DEBUGREG: {
+-		ret = -EINVAL;
+-		/* We only support one DABR and no IABRS at the moment */
+-		if (addr > 0)
++		ret = 0;
 +		if (access_process_vm(child, (u64)addrOthers, &tmp,
 +					sizeof(tmp), 1) == sizeof(tmp))
-+			break;
+ 			break;
+-		ret = put_user(child->thread.dabr,
+-			       (unsigned long __user *)data);
 +		ret = -EIO;
  		break;
  	}
  
--#ifdef CONFIG_PPC64
--	case PTRACE_SETREGS64:
--#endif
--	case PTRACE_SETREGS: { /* Set all gp regs in the child. */
--		unsigned long tmp;
--		int ui;
--	  	if (!access_ok(VERIFY_READ, (void __user *)data,
--			       sizeof(struct pt_regs))) {
--			ret = -EIO;
+-	case PTRACE_SET_DEBUGREG:
+-/*		ret = ptrace_set_debugreg(child, addr, data);*/
+-		break;
+-
+-	case PTRACE_DETACH:
+-		ret = ptrace_detach(child, data);
+-		break;
 +	/*
 +	 * This is like PTRACE_PEEKUSR on a 64-bit process,
 +	 * but here we access only 4 bytes at a time.
@@ -634,7 +610,15 @@
 +		} reg;
 +		int setno;
 +		const struct utrace_regset *regset;
-+
+ 
+-#ifdef CONFIG_PPC64
+-	case PTRACE_GETREGS64:
+-#endif
+-	case PTRACE_GETREGS: { /* Get all pt_regs from the child. */
+-		int ui;
+-	  	if (!access_ok(VERIFY_WRITE, (void __user *)data,
+-			       sizeof(struct pt_regs))) {
+-			ret = -EIO;
 +		ret = -EIO;
 +		if ((addr & 3) || addr > PT_FPSCR*8)
  			break;
@@ -646,10 +630,8 @@
  		}
 -		ret = 0;
 -		for (ui = 0; ui < PT_REGS_COUNT; ui ++) {
--			ret = __get_user(tmp, (unsigned long __user *) data);
--			if (ret)
--				break;
--/*			ptrace_put_reg(child, ui, tmp);*/
+-/*			ret |= __put_user(ptrace_get_reg(child, ui),
+-					  (unsigned long __user *) data);*/
 -			data += sizeof(long);
 -		}
 +		regset = utrace_regset(child, NULL,
@@ -662,11 +644,15 @@
  		break;
  	}
  
--	case PTRACE_GETFPREGS: { /* Get the child FPU state (FPR0...31 + FPSCR) */
--		flush_fp_to_thread(child);
--/*		ret = get_fpregs((void __user *)data, child, 1);*/
--		break;
--	}
+-#ifdef CONFIG_PPC64
+-	case PTRACE_SETREGS64:
+-#endif
+-	case PTRACE_SETREGS: { /* Set all gp regs in the child. */
+-		unsigned long tmp;
+-		int ui;
+-	  	if (!access_ok(VERIFY_READ, (void __user *)data,
+-			       sizeof(struct pt_regs))) {
+-			ret = -EIO;
 +	/*
 +	 * This is like PTRACE_POKEUSR on a 64-bit process,
 +	 * but here we access only 4 bytes at a time.
@@ -679,14 +665,25 @@
 +		} reg;
 +		int setno;
 +		const struct utrace_regset *regset;
- 
--	case PTRACE_SETFPREGS: { /* Set the child FPU state (FPR0...31 + FPSCR) */
--		flush_fp_to_thread(child);
--/*		ret = set_fpregs((void __user *)data, child, 1);*/
++
 +		ret = -EIO;
 +		if ((addr & 3) || addr > PT_FPSCR*8)
-+			break;
-+
+ 			break;
+-		}
+-		ret = 0;
+-		for (ui = 0; ui < PT_REGS_COUNT; ui ++) {
+-			ret = __get_user(tmp, (unsigned long __user *) data);
+-			if (ret)
+-				break;
+-/*			ptrace_put_reg(child, ui, tmp);*/
+-			data += sizeof(long);
+-		}
+-		break;
+-	}
+ 
+-	case PTRACE_GETFPREGS: { /* Get the child FPU state (FPR0...31 + FPSCR) */
+-		flush_fp_to_thread(child);
+-/*		ret = get_fpregs((void __user *)data, child, 1);*/
 +		setno = 0;
 +		if (addr >= PT_FPR0*8) {
 +			setno = 1;
@@ -703,31 +700,39 @@
  		break;
  	}
  
--#ifdef CONFIG_ALTIVEC
--	case PTRACE_GETVRREGS:
--		/* Get the child altivec register state. */
--		flush_altivec_to_thread(child);
--/*		ret = get_vrregs((unsigned long __user *)data, child);*/
+-	case PTRACE_SETFPREGS: { /* Set the child FPU state (FPR0...31 + FPSCR) */
+-		flush_fp_to_thread(child);
+-/*		ret = set_fpregs((void __user *)data, child, 1);*/
 -		break;
+-	}
 +	case PTRACE_GET_DEBUGREG:
-+	case PTRACE_SET_DEBUGREG:
 +		return ptrace_onereg_access(child, engine,
 +					    utrace_native_view(current), 3,
 +					    addr,
 +					    (u32 __user *) (unsigned long) data,
-+					    *request == PTRACE_SET_DEBUGREG);
++					    NULL, 0);
++	case PTRACE_SET_DEBUGREG:
++		return ptrace_onereg_access(child, engine,
++					    utrace_native_view(current), 3,
++					    addr, NULL, &data, 1);
 +
 +	case PTRACE_GETREGS:
 +	case PTRACE_SETREGS:
 +		return ptrace_regset_access(child, engine,
 +					    utrace_native_view(current), 0,
-+					    0, PT_REGS_COUNT * sizeof(int),
-+					    uaddr,
++					    0, PT_REGS_COUNT * sizeof(u32),
++					    (u32 __user *) (unsigned long) data,
 +					    *request == PTRACE_SETREGS);
  
+-#ifdef CONFIG_ALTIVEC
 +	case PTRACE_GETFPREGS:
 +	case PTRACE_SETFPREGS:
-+	case PTRACE_GETVRREGS:
+ 	case PTRACE_GETVRREGS:
+-		/* Get the child altivec register state. */
+-		flush_altivec_to_thread(child);
+-/*		ret = get_vrregs((unsigned long __user *)data, child);*/
+-		break;
+-
  	case PTRACE_SETVRREGS:
 -		/* Set the child altivec register state. */
 -		flush_altivec_to_thread(child);
@@ -1331,7 +1336,7 @@
  		tsk = next_thread(tsk);
 --- linux-2.6/kernel/ptrace.c
 +++ linux-2.6/kernel/ptrace.c
-@@ -19,213 +19,2009 @@
+@@ -19,213 +19,2011 @@
  #include <linux/security.h>
  #include <linux/signal.h>
  #include <linux/syscalls.h>
@@ -2002,7 +2007,7 @@
 +		     struct utrace_attached_engine *engine,
 +		     const struct utrace_regset_view *view,
 +		     int setno, unsigned long regno,
-+		     void __user *data, int write)
++		     void __user *udata, void *kdata, int write)
  {
 -	int copied = 0;
 +	const struct utrace_regset *regset = utrace_regset(target, engine,
@@ -2027,18 +2032,20 @@
 +	pos = (regno - regset->bias) * regset->size;
 +
 +	if (write) {
-+		if (!access_ok(VERIFY_READ, data, regset->size))
++		if (kdata == NULL &&
++		    !access_ok(VERIFY_READ, udata, regset->size))
 +			ret = -EIO;
 +		else
 +			ret = (*regset->set)(target, regset, pos, regset->size,
-+					     NULL, data);
++					     kdata, udata);
 +	}
 +	else {
-+		if (!access_ok(VERIFY_WRITE, data, regset->size))
++		if (kdata == NULL &&
++		    !access_ok(VERIFY_WRITE, udata, regset->size))
 +			ret = -EIO;
 +		else
 +			ret = (*regset->get)(target, regset, pos, regset->size,
-+					     NULL, data);
++					     kdata, udata);
 +	}
 +
 +	return ret;
@@ -3625,7 +3632,7 @@
 +				struct utrace_attached_engine *engine,
 +				const struct utrace_regset_view *view,
 +				int setno, unsigned long regno,
-+				void __user *data, int write);
++				void __user *udata, void *kdata, int write);
 +
 +
 +/*

linux-2.6-utrace-regset.patch:

Index: linux-2.6-utrace-regset.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-7/linux-2.6-utrace-regset.patch,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- linux-2.6-utrace-regset.patch	10 Oct 2007 21:22:57 -0000	1.6
+++ linux-2.6-utrace-regset.patch	9 Nov 2007 20:00:59 -0000	1.7
@@ -18,13 +18,13 @@
  arch/x86_64/kernel/ptrace.c    |  726 ++++++++++++++++++++++--------------
  arch/powerpc/kernel/Makefile   |    2 
  arch/powerpc/kernel/ptrace32.c |   20 -
- arch/powerpc/kernel/ptrace.c   |  617 ++++++++++++++++++++----------
+ arch/powerpc/kernel/ptrace.c   |  645 ++++++++++++++++++++++----------
  kernel/ptrace.c                |    9 
  include/linux/tracehook.h      |  255 ++++++++++++-
  include/asm-i386/i387.h        |   13 -
  include/asm-x86_64/fpu32.h     |    3 
  include/asm-x86_64/tracehook.h |    8 
- 13 files changed, 2203 insertions(+), 1218 deletions(-)
+ 13 files changed, 2230 insertions(+), 1219 deletions(-)
 
 --- linux-2.6/arch/i386/kernel/i387.c
 +++ linux-2.6/arch/i386/kernel/i387.c
@@ -3135,7 +3135,7 @@
 +	CHECK_FULL_REGS(target->thread.regs);
 +
 +	msr_save = target->thread.regs->msr &~ MSR_DEBUGCHANGE;
-+
+ 
 +	ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
 +				   target->thread.regs,
 +				   0, (PT_MAX_PUT_REG + 1) * sizeof(long));
@@ -3168,11 +3168,11 @@
 +			&pos, &count, &kbuf, &ubuf,
 +			offsetof(struct pt_regs, trap) + sizeof(trap), -1);
  
-+	return ret;
-+}
- 
 -static int get_fpregs(void __user *data, struct task_struct *task,
 -		      int has_fpscr)
++	return ret;
++}
++
 +static int
 +fpregs_get(struct task_struct *target,
 +	   const struct utrace_regset *regset,
@@ -3211,7 +3211,7 @@
  }
  
  
-@@ -140,61 +187,44 @@ static int set_fpregs(void __user *data,
+@@ -140,61 +187,70 @@ static int set_fpregs(void __user *data,
   * (combined (32- and 64-bit) gdb.
   */
  
@@ -3223,10 +3223,7 @@
 +vrregs_active(struct task_struct *target, const struct utrace_regset *regset)
  {
 -	unsigned long regsize;
-+	flush_altivec_to_thread(target);
-+	return target->thread.used_vr ? regset->n : 0;
-+}
- 
+-
 -	/* copy AltiVec registers VR[0] .. VR[31] */
 -	regsize = 32 * sizeof(vector128);
 -	if (copy_to_user(data, task->thread.vr, regsize))
@@ -3242,22 +3239,10 @@
 -	/* copy VRSAVE */
 -	if (put_user(task->thread.vrsave, (u32 __user *)data))
 -		return -EFAULT;
-+static int
-+vrregs_get(struct task_struct *target,
-+	   const struct utrace_regset *regset,
-+	   unsigned int pos, unsigned int count,
-+	   void *kbuf, void __user *ubuf)
-+{
-+	BUILD_BUG_ON(offsetof(struct thread_struct, vscr)
-+		     != offsetof(struct thread_struct, vr[32]));
-+	BUILD_BUG_ON(offsetof(struct thread_struct, vscr) + sizeof(vector128)
-+		     != offsetof(struct thread_struct, vrsave));
- 
+-
 -	return 0;
 +	flush_altivec_to_thread(target);
-+
-+	return utrace_regset_copyout(&pos, &count, &kbuf, &ubuf,
-+				     &target->thread.vr, 0, -1);
++	return target->thread.used_vr ? regset->n : 0;
  }
  
 -/*
@@ -3265,13 +3250,14 @@
 - */
 -static int set_vrregs(struct task_struct *task, unsigned long __user *data)
 +static int
-+vrregs_set(struct task_struct *target,
-+	    const struct utrace_regset *regset,
-+	    unsigned int pos, unsigned int count,
-+	    const void *kbuf, const void __user *ubuf)
++vrregs_get(struct task_struct *target,
++	   const struct utrace_regset *regset,
++	   unsigned int pos, unsigned int count,
++	   void *kbuf, void __user *ubuf)
  {
 -	unsigned long regsize;
--
++	int ret;
+ 
 -	/* copy AltiVec registers VR[0] .. VR[31] */
 -	regsize = 32 * sizeof(vector128);
 -	if (copy_from_user(task->thread.vr, data, regsize))
@@ -3287,21 +3273,62 @@
 -	/* copy VRSAVE */
 -	if (get_user(task->thread.vrsave, (u32 __user *)data))
 -		return -EFAULT;
-+	flush_altivec_to_thread(target);
++	BUILD_BUG_ON(offsetof(struct thread_struct, vscr)
++		     != offsetof(struct thread_struct, vr[32]));
  
 -	return 0;
-+	return utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
-+				    &target->thread.vr, 0, -1);
++	flush_altivec_to_thread(target);
++
++	ret = utrace_regset_copyout(&pos, &count, &kbuf, &ubuf,
++				    &target->thread.vr,
++				    0, 33 * sizeof(vector128));
++	if (ret == 0 && count > 0) {
++		/*
++		 * Copy out only the low-order word of vrsave.
++		 */
++		u32 vrsave = target->thread.vrsave;
++		ret = utrace_regset_copyout(&pos, &count, &kbuf, &ubuf, &vrsave,
++					    33 * sizeof(vector128), -1);
++	}
++
++	return ret;
  }
 -#endif /* CONFIG_ALTIVEC */
-+#endif	/* CONFIG_ALTIVEC */
  
- #ifdef CONFIG_SPE
--
+-#ifdef CONFIG_SPE
++static int
++vrregs_set(struct task_struct *target,
++	    const struct utrace_regset *regset,
++	    unsigned int pos, unsigned int count,
++	    const void *kbuf, const void __user *ubuf)
++{
++	int ret;
++
++	flush_altivec_to_thread(target);
++
++	ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
++				   &target->thread.vr,
++				   0, 33 * sizeof(vector128));
++	if (ret == 0 && count > 0) {
++		/*
++		 * Copy in only the low-order word of vrsave.
++		 */
++		u32 vrsave;
++		ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf, &vrsave,
++					   33 * sizeof(vector128), -1);
++		if (ret == 0)
++			target->thread.vrsave = vrsave;
++	}
+ 
++	return ret;
++}
++#endif	/* CONFIG_ALTIVEC */
++
++#ifdef CONFIG_SPE
  /*
   * For get_evrregs/set_evrregs functions 'data' has the following layout:
   *
-@@ -205,55 +235,45 @@ static int set_vrregs(struct task_struct
+@@ -205,55 +261,45 @@ static int set_vrregs(struct task_struct
   * }
   */
  
@@ -3388,7 +3415,7 @@
  }
  #endif /* CONFIG_SPE */
  
-@@ -287,13 +307,11 @@ void tracehook_disable_single_step(struc
+@@ -287,13 +333,11 @@ void tracehook_disable_single_step(struc
  	clear_tsk_thread_flag(task, TIF_SINGLESTEP);
  }
  
@@ -3406,7 +3433,7 @@
  	/* The bottom 3 bits are flags */
  	if ((data & ~0x7UL) >= TASK_SIZE)
  		return -EIO;
-@@ -306,17 +324,246 @@ static int ptrace_set_debugreg(struct ta
+@@ -306,17 +350,246 @@ static int ptrace_set_debugreg(struct ta
  	return 0;
  }
  
@@ -3659,7 +3686,7 @@
  /*
   * Here are the old "legacy" powerpc specific getregs/setregs ptrace calls,
   * we mark them as obsolete now, they will be removed in a future version
-@@ -359,13 +606,13 @@ static long arch_ptrace_old(struct task_
+@@ -359,13 +632,13 @@ static long arch_ptrace_old(struct task_
  
  	case PPC_PTRACE_GETFPREGS: { /* Get FPRs 0 - 31. */
  		flush_fp_to_thread(child);
@@ -3675,7 +3702,7 @@
  		break;
  	}
  
-@@ -402,7 +649,7 @@ long arch_ptrace(struct task_struct *chi
+@@ -402,7 +675,7 @@ long arch_ptrace(struct task_struct *chi
  
  		CHECK_FULL_REGS(child->thread.regs);
  		if (index < PT_FPR0) {
@@ -3684,7 +3711,7 @@
  		} else {
  			flush_fp_to_thread(child);
  			tmp = ((unsigned long *)child->thread.fpr)[index - PT_FPR0];
-@@ -435,7 +682,7 @@ long arch_ptrace(struct task_struct *chi
+@@ -435,7 +708,7 @@ long arch_ptrace(struct task_struct *chi
  
  		CHECK_FULL_REGS(child->thread.regs);
  		if (index < PT_FPR0) {
@@ -3693,7 +3720,7 @@
  		} else {
  			flush_fp_to_thread(child);
  			((unsigned long *)child->thread.fpr)[index - PT_FPR0] = data;
-@@ -444,52 +691,6 @@ long arch_ptrace(struct task_struct *chi
+@@ -444,52 +717,6 @@ long arch_ptrace(struct task_struct *chi
  		break;
  	}
  
@@ -3746,7 +3773,7 @@
  	case PTRACE_GET_DEBUGREG: {
  		ret = -EINVAL;
  		/* We only support one DABR and no IABRS at the moment */
-@@ -501,7 +702,7 @@ long arch_ptrace(struct task_struct *chi
+@@ -501,7 +728,7 @@ long arch_ptrace(struct task_struct *chi
  	}
  
  	case PTRACE_SET_DEBUGREG:
@@ -3755,7 +3782,7 @@
  		break;
  
  	case PTRACE_DETACH:
-@@ -520,8 +721,8 @@ long arch_ptrace(struct task_struct *chi
+@@ -520,8 +747,8 @@ long arch_ptrace(struct task_struct *chi
  		}
  		ret = 0;
  		for (ui = 0; ui < PT_REGS_COUNT; ui ++) {
@@ -3766,7 +3793,7 @@
  			data += sizeof(long);
  		}
  		break;
-@@ -543,7 +744,7 @@ long arch_ptrace(struct task_struct *chi
+@@ -543,7 +770,7 @@ long arch_ptrace(struct task_struct *chi
  			ret = __get_user(tmp, (unsigned long __user *) data);
  			if (ret)
  				break;
@@ -3775,7 +3802,7 @@
  			data += sizeof(long);
  		}
  		break;
-@@ -551,13 +752,13 @@ long arch_ptrace(struct task_struct *chi
+@@ -551,13 +778,13 @@ long arch_ptrace(struct task_struct *chi
  
  	case PTRACE_GETFPREGS: { /* Get the child FPU state (FPR0...31 + FPSCR) */
  		flush_fp_to_thread(child);
@@ -3791,7 +3818,7 @@
  		break;
  	}
  
-@@ -565,13 +766,13 @@ long arch_ptrace(struct task_struct *chi
+@@ -565,13 +792,13 @@ long arch_ptrace(struct task_struct *chi
  	case PTRACE_GETVRREGS:
  		/* Get the child altivec register state. */
  		flush_altivec_to_thread(child);
@@ -3807,7 +3834,7 @@
  		break;
  #endif
  #ifdef CONFIG_SPE
-@@ -579,7 +780,7 @@ long arch_ptrace(struct task_struct *chi
+@@ -579,7 +806,7 @@ long arch_ptrace(struct task_struct *chi
  		/* Get the child spe register state. */
  		if (child->thread.regs->msr & MSR_SPE)
  			giveup_spe(child);
@@ -3816,7 +3843,7 @@
  		break;
  
  	case PTRACE_SETEVRREGS:
-@@ -588,7 +789,7 @@ long arch_ptrace(struct task_struct *chi
+@@ -588,7 +815,7 @@ long arch_ptrace(struct task_struct *chi
  		 * of register state from memory */
  		if (child->thread.regs->msr & MSR_SPE)
  			giveup_spe(child);




More information about the fedora-extras-commits mailing list