lkml.org 
[lkml]   [2011]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 10/11] ptrace: move JOBCTL_TRAPPING wait to wait(2) and ptrace_check_attach()
    On 05/11, Oleg Nesterov wrote:
    >
    > You know, I'd wish I could find the serious bugs in this patch. The
    > code becomes really hairy. -EAGAIN in do_wait() doesn't make it more
    > simple ;)

    Mwahaha! I seem to see the bug ;)

    bool ptrace_wait_trapping(struct task_struct *child)
    __releases(&child->sighand->siglock)
    __releases(&tasklist_lock)
    {
    if (likely(!(child->jobctl & JOBCTL_TRAPPING)))
    return false;

    spin_unlock_irq(&child->sighand->siglock);
    get_task_struct(child);
    read_unlock(&tasklist_lock);

    --> WINDOW

    wait_event(current->signal->wait_chldexit,
    !(child->jobctl & JOBCTL_TRAPPING));
    put_task_struct(child);
    return true;
    }

    When the caller is do_wait(), we can't assume we are the tracer when
    we drop tasklist. Original tracer can detach, then another unrelated
    process can attach again and provoke JOBCTL_TRAPPING. wait_event()
    can hang forever.

    Unfortunately, this is easy to fix :/

    Oleg.



    \
     
     \ /
      Last update: 2011-05-11 19:05    [W:0.038 / U:0.120 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site