lkml.org 
[lkml]   [1999]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: vfork
From
Date
Wichert Akkerman <wakkerma@debian.org> writes:
> I started a bit on adding support for tracing clone() in strace. I have
> the basic framework in place, the only thing I need to do if I'm not
> mistaken is modify the clone flags to add CLONE_PTRACE. I haven't had
> the time to figure out how do to that yet..

I've been looking at this too (for a tool I'll release Real Soon Now), and
I've run across a few more things that seem to need tweaking.

The tracer (e.g., strace) needs to be able to wait on clone and non-clone kids
at the same time, but the current __WCLONE doesn't allow this. The change to
exit.c below changes its semantics to make it wait for all kids. (I wonder if
any existing software depends on the old semantics. We could always add a new
flag instead.)

The other change lets the tracer observe the new child coming out of a
fork/vfork/clone call.

These changes let me do tracing on a rudimentary case of clone. (I'm still
working on the other cases.)

--Mike



--- linux/kernel/exit.c-dist Thu Nov 25 23:06:48 1999
+++ linux/kernel/exit.c Tue Dec 28 01:17:40 1999
@@ -470,8 +470,10 @@
if (p->pgrp != -pid)
continue;
}
- /* wait for cloned processes iff the __WCLONE flag is set */
- if ((p->exit_signal != SIGCHLD) ^ ((options & __WCLONE) != 0))
+ /* skip cloned processes if the __WCLONE flag is not set */
+ /* we think a cloned process is one that reports to its parent
+ using SIGCHLD (why?) */
+ if ((p->exit_signal != SIGCHLD) && !(options & __WCLONE))
continue;
flag = 1;
switch (p->state) {
--- linux/arch/i386/kernel/entry.S-dist Mon Dec 27 23:28:14 1999
+++ linux/arch/i386/kernel/entry.S Mon Dec 27 23:44:45 1999
@@ -180,6 +180,8 @@
call SYMBOL_NAME(schedule_tail)
addl $4, %esp
GET_CURRENT(%ebx)
+ testb $0x20,flags(%ebx) # PF_TRACESYS
+ jne tracesys_exit # need to set eax first??
jmp ret_from_sys_call

/*

--
Any sufficiently adverse technology is indistinguishable from Microsoft.

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

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.080 / U:0.648 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site