Messages in this thread |  | | Date | Thu, 31 Aug 2000 22:23:27 -0500 | From | Michael Elizabeth Chastain <> | Subject | Re: 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/
|  |