[PATCH] Do not trace children created with CLONE_UNTRACED flag

Wang Chao wang.chao at cn.fujitsu.com
Mon Sep 13 03:42:57 UTC 2010

Sent on 2010-9-10 17:26, Roland McGrath wrote:
>> I quite agree with the above change.
> Does that mean you tested it?

Very sorry for my last reply, actually there are indeed some
problems here. For syscall who has no arguments such as vfork
accessing tcp->u_arg here may result an undetermined value.

What we want to change only occur in clone syscall, so I think
we may add one more check here, just like the patch below.

What do you think?

Wang Chao


diff --git a/process.c b/process.c
index 8af960a..d587379 100644
--- a/process.c
+++ b/process.c
@@ -796,8 +796,12 @@ int
 internal_fork(struct tcb *tcp)
 	if (entering(tcp)) {
+		tcp->flags &= ~TCB_FOLLOWFORK;
 		if (!followfork)
 			return 0;
+		if ((known_scno(tcp) == SYS_clone) &&
+		    (tcp->u_arg[ARG_FLAGS] & CLONE_UNTRACED))
+			return 0;
 		if (setbpt(tcp) < 0)
 			return 0;

More information about the Strace-devel mailing list