[PATCH/v2 2/2] Handle followfork using ptrace_setoptions if available

Wang Chao wang.chao at cn.fujitsu.com
Thu Oct 7 02:45:24 UTC 2010


Sent on 2010-10-7 10:31, Wang Chao wrote:
>  internal_fork(struct tcb *tcp)
>  {
> +	if ((ptrace_setoptions
> +	    & (PTRACE_O_TRACECLONE | PTRACE_O_TRACEFORK | PTRACE_O_TRACEVFORK))
> +	   == (PTRACE_O_TRACECLONE | PTRACE_O_TRACEFORK | PTRACE_O_TRACEVFORK))
> +		return 0;
> +

Sent on 2010-10-5 12:45, Roland McGrath wrote:
> I don't think you want to skip all of internal_fork.
> e.g. I think fork_tcb is still useful.
> 
> I think you just want to conditionalize the setbpt call.
> 

Well, in my opinion, we can skip whole internal_fork call safely
here if PTRACE_SETOPTIONS is in charge. 

Currently, I think TCB_FOLLOWFORK is used to distinguish the
new forked child and original parent at exit point of fork
syscall. While using PTRACE_SETOPTIONS, new child will be
handled when we revice PTRACE_EVENT_* status and I think no
more work will be needed in internal_fork.

I'm sorry if i don't understand correctly.

Thanks,
Wang Chao





More information about the Strace-devel mailing list