[PATCH 1/2] remove TCB_SUSPENDED

Denys Vlasenko dvlasenk at redhat.com
Wed Aug 17 13:28:36 UTC 2011


On Sat, 2011-06-25 at 11:34 +0200, Denys Vlasenko wrote:
> This patch is on top of "do not detach when we think tracee is going to die".
> 
> Since we no longer suspend waitpid'ing tracees, we have only one case when
> we suspend tracee: when we pick up a new tracee created by clone/fork/vfork.
> 
> Background: on some other OSes, attach to child is done this way:
> get fork's result (pid), loop ptrace(PTRACE_ATTACH) until you hook up
> new process/thread. This is ugly and not safe, but what matters for us
> is that it doesn't require suspending. 
> 
> Only on Linux, it does. On Linux, we use two methods of catching
> new tracee: adding CLONE_THREAD bit to syscall (if needed, we change
> [v]fork into clone before that), or using ptrace options.
> In both cases, it may be so that new tracee appears before one which
> created it returns from syscall. In this case, current code
> suspends new tracee until its creator returns. Only then
> strace can determine who is its parent (it needs child's pid for this).
> This is inherently racy. For example, what if SIGKILL kills
> creator after it succeeded creating child, but before it returns?
> Looks like we will have child suspended forever.
> 
> But after "do not detach when we think tracee is going to die" patch,
> we DO NOT NEED parent<->child link for anything. Therefore
> we do not need suspending too. Bingo!
> 
> This patch removes suspending code. Now new tracees will be continued
> right away. Next patch will remove tcp->parent member.

Applied this patch to git.

-- 
vda






More information about the Strace-devel mailing list