lkml.org 
[lkml]   [2000]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Tracing in the presence of forks.
> Is there any mechanism to automatically stop a process created
> by a traced parent preventing this race condition from occurring ?

Yeah, use ptrace to stop on every child system call. When the child
calls fork(), then change its memory at the return instruction to
"jmp ." instruction. Then the grandchild will be born into slavery
and you can attach to it before it runs away.

Works for me.

You could do the same thing without stopping on every system call by
assuming that "fork" is the only function that actually calls the kernel
to fork, and setting breakpoints in there and then doing the "jmp ."
trick. That doesn't protect against children that are actively seeking
to evade control but it ought to work on all well behaved citizens.

Gosh, I feel like Big Brother now.

Michael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:39    [W:0.058 / U:1.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site