* util.c [LINUX] (setbpt): When clone is called with CLONE_UNTRACED, clear that flag. Contrary to all documentation and man pages, this flag has nothing to do with CLONE_PTRACE and does not prevent tracing. The only effect is to stop a PTRACE_EVENT_{FORK,VFORK,CLONE} event from being sent to the parent. Normally only used by the kernel internally, userspace can set this flag, and then we would miss the event. So clear the flag.
Signed-off-by: Jamie Lokier <ja...@shareable.org> --- util.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/util.c b/util.c index beb397e..96f42c0 100644 --- a/util.c +++ b/util.c @@ -1564,6 +1564,11 @@ setbpt(struct tcb *tcp) || get_arg0 (tcp, &state, &tcp->inst[0]) < 0 || get_arg1 (tcp, &state, &tcp->inst[1]) < 0) return -1; +# ifdef CLONE_UNTRACED + /* If CLONE_UNTRACED, we'll override it. */ + if (tcp->inst[0] & CLONE_UNTRACED) + goto clear_untraced; +# endif tcp->u_arg[arg0_index] = tcp->inst[0]; return 0; } @@ -1598,6 +1603,9 @@ setbpt(struct tcb *tcp) break; # endif +# ifdef CLONE_UNTRACED + clear_untraced: +# endif default: /* clone, clone2 */ /* * Some archs call `clone (CLONE_VFORK | CLONE_VM)' @@ -1608,6 +1616,9 @@ setbpt(struct tcb *tcp) * must stay for threads. */ tcp->u_arg[arg0_index] = tcp->inst[0] | CLONE_PTRACE; +# ifdef CLONE_UNTRACED + tcp->u_arg[arg0_index] &= ~CLONE_UNTRACED; +# endif if (tcp->u_arg[arg0_index] & CLONE_VFORK) tcp->u_arg[arg0_index] &= ~(CLONE_VFORK | CLONE_VM); tcp->u_arg[arg1_index] = tcp->inst[1]; -- 1.7.0.4 _______________________________________________ uClinux-dev mailing list uClinux-dev@uclinux.org http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by uclinux-dev@uclinux.org To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev