lkml.org 
[lkml]   [2007]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[05/50] setpgid(child) fails if the child was forked by sub-thread

    From: Oleg Nesterov <oleg@tv-sign.ru>

    commit b07e35f94a7b6a059f889b904529ee907dc0634d in mainline tree

    Spotted by Marcin Kowalczyk <qrczak@knm.org.pl>.

    sys_setpgid(child) fails if the child was forked by sub-thread.

    Fix the "is it our child" check. The previous commit
    ee0acf90d320c29916ba8c5c1b2e908d81f5057d was not complete.

    (this patch asks for the new same_thread_group() helper, but mainline doesn't
    have it yet).

    Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
    Acked-by: Roland McGrath <roland@redhat.com>
    Tested-by: "Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


    ---
    kernel/sys.c | 3 +--
    1 file changed, 1 insertion(+), 2 deletions(-)

    --- a/kernel/sys.c
    +++ b/kernel/sys.c
    @@ -1428,7 +1428,6 @@ asmlinkage long sys_times(struct tms __u
    * Auch. Had to add the 'did_exec' flag to conform completely to POSIX.
    * LBT 04.03.94
    */
    -
    asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
    {
    struct task_struct *p;
    @@ -1456,7 +1455,7 @@ asmlinkage long sys_setpgid(pid_t pid, p
    if (!thread_group_leader(p))
    goto out;

    - if (p->real_parent == group_leader) {
    + if (p->real_parent->tgid == group_leader->tgid) {
    err = -EPERM;
    if (task_session(p) != task_session(group_leader))
    goto out;
    --
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2007-09-24 18:29    [W:0.022 / U:1.208 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site