Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[pandora-kernel.git] / arch / x86_64 / ia32 / ptrace32.c
index a590b7a..d18198e 100644 (file)
@@ -117,6 +117,10 @@ static int putreg32(struct task_struct *child, unsigned regno, u32 val)
                        if ((0x5454 >> ((val >> (16 + 4*i)) & 0xf)) & 1)
                               return -EIO;
                child->thread.debugreg7 = val; 
+               if (val)
+                       set_tsk_thread_flag(child, TIF_DEBUG);
+               else
+                       clear_tsk_thread_flag(child, TIF_DEBUG);
                break; 
                    
        default:
@@ -202,17 +206,24 @@ static long ptrace32_siginfo(unsigned request, u32 pid, u32 addr, u32 data)
 {
        int ret;
        compat_siginfo_t *si32 = (compat_siginfo_t *)compat_ptr(data);
+       siginfo_t ssi; 
        siginfo_t *si = compat_alloc_user_space(sizeof(siginfo_t));
        if (request == PTRACE_SETSIGINFO) {
-               ret = copy_siginfo_from_user32(si, si32);
+               memset(&ssi, 0, sizeof(siginfo_t));
+               ret = copy_siginfo_from_user32(&ssi, si32);
                if (ret)
                        return ret;
+               if (copy_to_user(si, &ssi, sizeof(siginfo_t)))
+                       return -EFAULT;
        }
        ret = sys_ptrace(request, pid, addr, (unsigned long)si);
        if (ret)
                return ret;
-       if (request == PTRACE_GETSIGINFO)
-               ret = copy_siginfo_to_user32(si32, si);
+       if (request == PTRACE_GETSIGINFO) {
+               if (copy_from_user(&ssi, si, sizeof(siginfo_t)))
+                       return -EFAULT;
+               ret = copy_siginfo_to_user32(si32, &ssi);
+       }
        return ret;
 }
 
@@ -364,8 +375,10 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
                ret = -EIO;
                if (!access_ok(VERIFY_READ, u, sizeof(*u)))
                        break;
-               /* no checking to be bug-to-bug compatible with i386 */
-               __copy_from_user(&child->thread.i387.fxsave, u, sizeof(*u));
+               /* no checking to be bug-to-bug compatible with i386. */
+               /* but silence warning */
+               if (__copy_from_user(&child->thread.i387.fxsave, u, sizeof(*u)))
+                       ;
                set_stopped_child_used_math(child);
                child->thread.i387.fxsave.mxcsr &= mxcsr_feature_mask;
                ret = 0;