If clone is called with flag CLONE_UNTRACED, to be consistent with
option PTRACE_O_TRACECLONE, we should not set CLONE_PTRACE flag on
its arguments.

* process.c [LINUX] (internal_fork): Check the syscall and arguments.

Signed-off-by: Wang Chao <[email protected]>
---
 process.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/process.c b/process.c
index 8999fc6..f246bcb 100644
--- a/process.c
+++ b/process.c
@@ -796,8 +796,16 @@ int
 internal_fork(struct tcb *tcp)
 {
        if (entering(tcp)) {
+               tcp->flags &= ~TCB_FOLLOWFORK;
                if (!followfork)
                        return 0;
+               /* In occasion of using PTRACE_O_TRACECLONE, we won't see the
+                * new child if clone is called with flag CLONE_UNTRACED, so
+                * we keep the same logic with that option and dont't trace it.
+                */
+               if ((sysent[tcp->scno].sys_func == sys_clone) &&
+                   (tcp->u_arg[ARG_FLAGS] & CLONE_UNTRACED))
+                       return 0;
                fork_tcb(tcp);
                if (setbpt(tcp) < 0)
                        return 0;
-- 
1.6.5.2


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to