vserver 1.9.5.x5
[linux-2.6.git] / arch / m68knommu / kernel / ptrace.c
index 4f3df6d..6eee843 100644 (file)
@@ -124,6 +124,8 @@ asmlinkage 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 */
@@ -133,13 +135,6 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
                ret = ptrace_attach(child);
                goto out_tsk;
        }
-       ret = -ESRCH;
-       if (!(child->ptrace & PT_PTRACED))
-               goto out_tsk;
-       if (child->state != TASK_STOPPED) {
-               if (request != PTRACE_KILL)
-                       goto out_tsk;
-       }
        ret = ptrace_check_attach(child, request == PTRACE_KILL);
        if (ret < 0)
                goto out_tsk;
@@ -271,7 +266,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
                        long tmp;
 
                        ret = 0;
-                       if (child->state == TASK_ZOMBIE) /* already dead */
+                       if (child->exit_state == EXIT_ZOMBIE) /* already dead */
                                break;
                        child->exit_code = SIGKILL;
                        /* make sure the single step bit is not set. */
@@ -376,10 +371,8 @@ asmlinkage void syscall_trace(void)
                return;
        if (!(current->ptrace & PT_PTRACED))
                return;
-       current->exit_code = SIGTRAP;
-       current->state = TASK_STOPPED;
-       notify_parent(current, SIGCHLD);
-       schedule();
+       ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
+                                ? 0x80 : 0));
        /*
         * this isn't the same as continuing with a signal, but it will do
         * for normal use.  strace only continues with a signal if the