X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fppc64%2Fkernel%2Fptrace.c;h=9c3d2f55ef9084901e66c10bc2b1c950d8fc0fef;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=6afe71a7d56c93f651e194bbbc52c9a6dce95bbd;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/arch/ppc64/kernel/ptrace.c b/arch/ppc64/kernel/ptrace.c index 6afe71a7d..9c3d2f55e 100644 --- a/arch/ppc64/kernel/ptrace.c +++ b/arch/ppc64/kernel/ptrace.c @@ -76,6 +76,8 @@ int sys_ptrace(long request, long pid, long addr, long data) read_unlock(&tasklist_lock); if (!child) goto out; + if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) + goto out_tsk; ret = -EPERM; if (pid == 1) /* you may not mess with init */ @@ -101,7 +103,7 @@ int sys_ptrace(long request, long pid, long addr, long data) ret = -EIO; if (copied != sizeof(tmp)) break; - ret = put_user(tmp,(unsigned long *) data); + ret = put_user(tmp,(unsigned long __user *) data); break; } @@ -119,11 +121,10 @@ int sys_ptrace(long request, long pid, long addr, long data) if (index < PT_FPR0) { tmp = get_reg(child, (int)index); } else { - if (child->thread.regs->msr & MSR_FP) - giveup_fpu(child); + flush_fp_to_thread(child); tmp = ((unsigned long *)child->thread.fpr)[index - PT_FPR0]; } - ret = put_user(tmp,(unsigned long *) data); + ret = put_user(tmp,(unsigned long __user *) data); break; } @@ -152,8 +153,7 @@ int sys_ptrace(long request, long pid, long addr, long data) if (index < PT_FPR0) { ret = put_reg(child, index, data); } else { - if (child->thread.regs->msr & MSR_FP) - giveup_fpu(child); + flush_fp_to_thread(child); ((unsigned long *)child->thread.fpr)[index - PT_FPR0] = data; ret = 0; } @@ -213,7 +213,7 @@ int sys_ptrace(long request, long pid, long addr, long data) case PPC_PTRACE_GETREGS: { /* Get GPRs 0 - 31. */ int i; unsigned long *reg = &((unsigned long *)child->thread.regs)[0]; - unsigned long *tmp = (unsigned long *)addr; + unsigned long __user *tmp = (unsigned long __user *)addr; for (i = 0; i < 32; i++) { ret = put_user(*reg, tmp); @@ -228,7 +228,7 @@ int sys_ptrace(long request, long pid, 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 *tmp = (unsigned long *)addr; + unsigned long __user *tmp = (unsigned long __user *)addr; for (i = 0; i < 32; i++) { ret = get_user(*reg, tmp); @@ -243,10 +243,9 @@ int sys_ptrace(long request, long pid, long addr, long data) case PPC_PTRACE_GETFPREGS: { /* Get FPRs 0 - 31. */ int i; unsigned long *reg = &((unsigned long *)child->thread.fpr)[0]; - unsigned long *tmp = (unsigned long *)addr; + unsigned long __user *tmp = (unsigned long __user *)addr; - if (child->thread.regs->msr & MSR_FP) - giveup_fpu(child); + flush_fp_to_thread(child); for (i = 0; i < 32; i++) { ret = put_user(*reg, tmp); @@ -261,10 +260,9 @@ int sys_ptrace(long request, long pid, long addr, long data) case PPC_PTRACE_SETFPREGS: { /* Get FPRs 0 - 31. */ int i; unsigned long *reg = &((unsigned long *)child->thread.fpr)[0]; - unsigned long *tmp = (unsigned long *)addr; + unsigned long __user *tmp = (unsigned long __user *)addr; - if (child->thread.regs->msr & MSR_FP) - giveup_fpu(child); + flush_fp_to_thread(child); for (i = 0; i < 32; i++) { ret = get_user(*reg, tmp);