[PATCH] Do not trace children created with CLONE_UNTRACED flag
Roland McGrath
roland at redhat.com
Fri Sep 10 08:05:53 UTC 2010
> But I'm wondering the following situation though maybe it's not common:
> we've already traced a process A and its children, A should have TCB_FOLLOWFORK
> set. And then if A calls clone with CLONE_UNTRACED, I think strace will still
> allocate tcb for the new child which we don't trace.
>
> I'm sorry if I don't understand correctly.
You are quite right. The setting of the TCB_FOLLOWFORK bit got moved
around in a previous cleanup, and it now actually has no useful meaning at
all, it's essentially always set. But it is already tested in the places
we need for the related new purpose of this change. So I think the patch
below would indeed do the trick.
What do you think?
Thanks,
Roland
======
diff --git a/process.c b/process.c
index 8af960a..50f5ae8 100644
--- a/process.c
+++ b/process.c
@@ -796,7 +796,8 @@ int
internal_fork(struct tcb *tcp)
{
if (entering(tcp)) {
- if (!followfork)
+ tcp->flags &= ~TCB_FOLLOWFORK;
+ if (!followfork || (tcp->u_arg[ARG_FLAGS] & CLONE_UNTRACED))
return 0;
fork_tcb(tcp);
if (setbpt(tcp) < 0)
More information about the Strace-devel
mailing list