Skip to content
  • Eric W. Biederman's avatar
    [PATCH] de_thread: Don't change our parents and ptrace flags. · c06511d1
    Eric W. Biederman authored
    
    
    This is two distinct changes.
     - Not changing our real parents.
     - Not changing our ptrace parents.
    
    Not changing our real parents is trivially correct because both tasks
    have the same real parents as they are part of a thread group.  Now that
    we demote the leader to a thread there is no longer any reason to change
    it's parentage.
    
    Not changing our ptrace parents is a user visible change if someone
    looks hard enough.  I don't think user space applications will care or
    even notice.
    
    In the practical and I think common case a debugger will have attached
    to all of the threads using the same ptrace flags.  From my quick skim
    of strace and gdb that appears to be the case.  Which if true means
    debuggers will not notice a change.
    
    Before this point we have already generated a ptrace event in do_exit
    that reports the leaders pid has died so de_thread is visible to a
    debugger.  Which means attempting to hide this case by copying flags
    around appears excessive.
    
    By not doing anything it avoids all of the weird locking issues between
    de_thread and ptrace attach, and removes one case from consideration for
    fixing the ptrace locking.
    
    This only addresses Oleg's first concern with ptrace_attach, that of the
    problems caused by reparenting.  Oleg's second concern is essentially a
    race between ptrace_attach and release_task that causes an oops when we
    get to force_sig_specific.  There is nothing special about de_thread
    with respect to that race.
    
    Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    c06511d1