• Eric W. Biederman's avatar
    [PATCH] ptrace: document the locking rules · 260ea101
    Eric W. Biederman authored
    After a lot of reading the code and thinking about how it behaves I have
    managed to figure out what the current ptrace locking rules are.  The
    current code is in much better that it appears at first glance.  The
    troublesome code paths are actually the code paths that violate the current
    rules.
    
    ptrace uses simple exclusive access as it's locking.  You can only touch
    task->ptrace if the task is stopped and you are the ptracer, or if the task
    is running and are the task itself.
    
    Very simple, very easy to maintain.  It just needs to be documented so
    people know not to touch ptrace from elsewhere.
    
    Currently we do have a few pieces of code that are in violation of this
    rule.  Particularly the core dump code, and ptrace_attach.  But so far the
    code looks fixable.
    Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
    Cc: Oleg Nesterov <oleg@tv-sign.ru>
    Cc: Roland McGrath <roland@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    260ea101
ptrace.h 4.5 KB