[PATCH] setpgid: should not accept ptraced childs
authorOleg Nesterov <oleg@tv-sign.ru>
Sun, 8 Jan 2006 09:03:59 +0000 (01:03 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 9 Jan 2006 04:14:01 +0000 (20:14 -0800)
sys_setpgid() allows to change ->pgrp of ptraced childs.

'man setpgid' does not tell anything about that, so I consider
this behaviour is a bug.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Oren Laadan <orenl@cs.columbia.edu>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/sys.c

index f497bf56ada1da3656a9bde1002925f0eb15bddd..218937e837dcb08b3c7c473e46c1ae5153beb4dd 100644 (file)
@@ -1114,7 +1114,7 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
        if (!thread_group_leader(p))
                goto out;
 
-       if (p->parent == current || p->real_parent == group_leader) {
+       if (p->real_parent == group_leader) {
                err = -EPERM;
                if (p->signal->session != group_leader->signal->session)
                        goto out;