The changes in tracehook_prepare_clone() and tracehook_report_clone()
are no longer needed, we can revert them to lessen the size of the
first patch(es) and simplify the review/merging.

The reverted changes were necessary before, now

        - tracehook_prepare_clone()

          none of "->ptrace & PT_" conditions can be true,
          ->ptrace can contain only PT_PTRACED or PT_PTRACE_CAP

        - tracehook_report_clone()

          task_ptrace(child) is not possible at this point

see also the next patches.

---

 include/linux/tracehook.h |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

--- PU/include/linux/tracehook.h~110_REVERT_CLONE_CHANGES_IN_H  2009-09-02 
20:30:00.000000000 +0200
+++ PU/include/linux/tracehook.h        2009-10-21 19:20:39.000000000 +0200
@@ -208,6 +208,18 @@ static inline void tracehook_report_exit
  */
 static inline int tracehook_prepare_clone(unsigned clone_flags)
 {
+       if (clone_flags & CLONE_UNTRACED)
+               return 0;
+
+       if (clone_flags & CLONE_VFORK) {
+               if (current->ptrace & PT_TRACE_VFORK)
+                       return PTRACE_EVENT_VFORK;
+       } else if ((clone_flags & CSIGNAL) != SIGCHLD) {
+               if (current->ptrace & PT_TRACE_CLONE)
+                       return PTRACE_EVENT_CLONE;
+       } else if (current->ptrace & PT_TRACE_FORK)
+               return PTRACE_EVENT_FORK;
+
        return 0;
 }
 
@@ -252,6 +264,14 @@ static inline void tracehook_report_clon
 {
        if (unlikely(task_utrace_flags(current) & UTRACE_EVENT(CLONE)))
                utrace_report_clone(clone_flags, child);
+       if (unlikely(task_ptrace(child))) {
+               /*
+                * It doesn't matter who attached/attaching to this
+                * task, the pending SIGSTOP is right in any case.
+                */
+               sigaddset(&child->pending.signal, SIGSTOP);
+               set_tsk_thread_flag(child, TIF_SIGPENDING);
+       }
 }
 
 /**

Reply via email to