From ad1029ec4e8e03c2d38ee6c5b0207b3b2b58e333 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 25 Jul 2008 19:45:47 -0700 Subject: [PATCH] --- yaml --- r: 106210 b: refs/heads/master c: daded34be96b1975ff8539ff62ad8b158ce7d842 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/tracehook.h | 18 ++++++++++++++++++ trunk/kernel/fork.c | 5 +---- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index a46809468200..a7266b2fc3e4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 09a05394fe2448a4139b014936330af23fa7ec83 +refs/heads/master: daded34be96b1975ff8539ff62ad8b158ce7d842 diff --git a/trunk/include/linux/tracehook.h b/trunk/include/linux/tracehook.h index 3ebc58b59766..830e6e16097d 100644 --- a/trunk/include/linux/tracehook.h +++ b/trunk/include/linux/tracehook.h @@ -210,4 +210,22 @@ static inline void tracehook_report_clone_complete(int trace, ptrace_event(0, trace, pid); } +/** + * tracehook_report_vfork_done - vfork parent's child has exited or exec'd + * @child: child task, already running + * @pid: new child's PID in the parent's namespace + * + * Called after a %CLONE_VFORK parent has waited for the child to complete. + * The clone/vfork system call will return immediately after this. + * The @child pointer may be invalid if a self-reaping child died and + * tracehook_report_clone() took no action to prevent it from self-reaping. + * + * Called with no locks held. + */ +static inline void tracehook_report_vfork_done(struct task_struct *child, + pid_t pid) +{ + ptrace_event(PT_TRACE_VFORK_DONE, PTRACE_EVENT_VFORK_DONE, pid); +} + #endif /* */ diff --git a/trunk/kernel/fork.c b/trunk/kernel/fork.c index b42f8ed23611..abb3ed6298f6 100644 --- a/trunk/kernel/fork.c +++ b/trunk/kernel/fork.c @@ -1414,10 +1414,7 @@ long do_fork(unsigned long clone_flags, freezer_do_not_count(); wait_for_completion(&vfork); freezer_count(); - if (unlikely (current->ptrace & PT_TRACE_VFORK_DONE)) { - current->ptrace_message = nr; - ptrace_notify ((PTRACE_EVENT_VFORK_DONE << 8) | SIGTRAP); - } + tracehook_report_vfork_done(p, nr); } } else { nr = PTR_ERR(p);