aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/ptrace32.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2007-09-24 19:50:52 -0400
committerPaul Mackerras <paulus@samba.org>2007-10-02 21:48:43 -0400
commitfabca2c0a461bd82a35194e3a4bb1e98f3ffa789 (patch)
tree298cc7b2c3cbfa82388b0b04c89882d6911d4a01 /arch/powerpc/kernel/ptrace32.c
parentfec6047047fda307e47b9e87697144a89528c752 (diff)
[POWERPC] Add CHECK_FULL_REGS in several places in ptrace code
This restores the CHECK_FULL_REGS sanity check to every place that can access the nonvolatile GPRs for ptrace. This is already done for native-bitwidth PTRACE_PEEKUSR, but was omitted for many other cases (32-bit ptrace, PTRACE_GETREGS, etc.); I think there may have been more uniform checks before that were lost in the recent cleanup of GETREGS et al. Signed-off-by: Roland McGrath <roland@redhat.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/ptrace32.c')
-rw-r--r--arch/powerpc/kernel/ptrace32.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/ptrace32.c b/arch/powerpc/kernel/ptrace32.c
index 9e6baeac0fb1..fea6206ff90f 100644
--- a/arch/powerpc/kernel/ptrace32.c
+++ b/arch/powerpc/kernel/ptrace32.c
@@ -53,6 +53,7 @@ static long compat_ptrace_old(struct task_struct *child, long request,
53 unsigned long *reg = &((unsigned long *)child->thread.regs)[0]; 53 unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
54 unsigned int __user *tmp = (unsigned int __user *)addr; 54 unsigned int __user *tmp = (unsigned int __user *)addr;
55 55
56 CHECK_FULL_REGS(child->thread.regs);
56 for (i = 0; i < 32; i++) { 57 for (i = 0; i < 32; i++) {
57 ret = put_user(*reg, tmp); 58 ret = put_user(*reg, tmp);
58 if (ret) 59 if (ret)
@@ -68,6 +69,7 @@ static long compat_ptrace_old(struct task_struct *child, long request,
68 unsigned long *reg = &((unsigned long *)child->thread.regs)[0]; 69 unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
69 unsigned int __user *tmp = (unsigned int __user *)addr; 70 unsigned int __user *tmp = (unsigned int __user *)addr;
70 71
72 CHECK_FULL_REGS(child->thread.regs);
71 for (i = 0; i < 32; i++) { 73 for (i = 0; i < 32; i++) {
72 ret = get_user(*reg, tmp); 74 ret = get_user(*reg, tmp);
73 if (ret) 75 if (ret)
@@ -164,6 +166,7 @@ long compat_sys_ptrace(int request, int pid, unsigned long addr,
164 if ((addr & 3) || (index > PT_FPSCR32)) 166 if ((addr & 3) || (index > PT_FPSCR32))
165 break; 167 break;
166 168
169 CHECK_FULL_REGS(child->thread.regs);
167 if (index < PT_FPR0) { 170 if (index < PT_FPR0) {
168 tmp = ptrace_get_reg(child, index); 171 tmp = ptrace_get_reg(child, index);
169 } else { 172 } else {
@@ -210,6 +213,7 @@ long compat_sys_ptrace(int request, int pid, unsigned long addr,
210 if ((addr & 3) || numReg > PT_FPSCR) 213 if ((addr & 3) || numReg > PT_FPSCR)
211 break; 214 break;
212 215
216 CHECK_FULL_REGS(child->thread.regs);
213 if (numReg >= PT_FPR0) { 217 if (numReg >= PT_FPR0) {
214 flush_fp_to_thread(child); 218 flush_fp_to_thread(child);
215 tmp = ((unsigned long int *)child->thread.fpr)[numReg - PT_FPR0]; 219 tmp = ((unsigned long int *)child->thread.fpr)[numReg - PT_FPR0];
@@ -270,6 +274,7 @@ long compat_sys_ptrace(int request, int pid, unsigned long addr,
270 if ((addr & 3) || (index > PT_FPSCR32)) 274 if ((addr & 3) || (index > PT_FPSCR32))
271 break; 275 break;
272 276
277 CHECK_FULL_REGS(child->thread.regs);
273 if (index < PT_FPR0) { 278 if (index < PT_FPR0) {
274 ret = ptrace_put_reg(child, index, data); 279 ret = ptrace_put_reg(child, index, data);
275 } else { 280 } else {
@@ -307,6 +312,7 @@ long compat_sys_ptrace(int request, int pid, unsigned long addr,
307 */ 312 */
308 if ((addr & 3) || (numReg > PT_FPSCR)) 313 if ((addr & 3) || (numReg > PT_FPSCR))
309 break; 314 break;
315 CHECK_FULL_REGS(child->thread.regs);
310 if (numReg < PT_FPR0) { 316 if (numReg < PT_FPR0) {
311 unsigned long freg = ptrace_get_reg(child, numReg); 317 unsigned long freg = ptrace_get_reg(child, numReg);
312 if (index % 2) 318 if (index % 2)
@@ -342,6 +348,7 @@ long compat_sys_ptrace(int request, int pid, unsigned long addr,
342 ret = -EIO; 348 ret = -EIO;
343 break; 349 break;
344 } 350 }
351 CHECK_FULL_REGS(child->thread.regs);
345 ret = 0; 352 ret = 0;
346 for (ui = 0; ui < PT_REGS_COUNT; ui ++) { 353 for (ui = 0; ui < PT_REGS_COUNT; ui ++) {
347 ret |= __put_user(ptrace_get_reg(child, ui), 354 ret |= __put_user(ptrace_get_reg(child, ui),
@@ -359,6 +366,7 @@ long compat_sys_ptrace(int request, int pid, unsigned long addr,
359 ret = -EIO; 366 ret = -EIO;
360 break; 367 break;
361 } 368 }
369 CHECK_FULL_REGS(child->thread.regs);
362 ret = 0; 370 ret = 0;
363 for (ui = 0; ui < PT_REGS_COUNT; ui ++) { 371 for (ui = 0; ui < PT_REGS_COUNT; ui ++) {
364 ret = __get_user(tmp, (unsigned int __user *) data); 372 ret = __get_user(tmp, (unsigned int __user *) data);