Revert utrace-ptrace changes in tracehook.h.

The reverted change in tracehook_signal_handler() breaks utrace-ptrace,
fixed by the next patch.

---

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

--- PU/include/linux/tracehook.h~116_REVERT_TRACEHOOK   2009-10-21 
19:46:33.000000000 +0200
+++ PU/include/linux/tracehook.h        2009-10-26 00:06:21.000000000 +0100
@@ -69,6 +69,29 @@ static inline int tracehook_expect_break
        return (task_ptrace(task) & PT_PTRACED) != 0;
 }
 
+/*
+ * ptrace report for syscall entry and exit looks identical.
+ */
+static inline void ptrace_report_syscall(struct pt_regs *regs)
+{
+       int ptrace = task_ptrace(current);
+
+       if (!(ptrace & PT_PTRACED))
+               return;
+
+       ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
+
+       /*
+        * this isn't the same as continuing with a signal, but it will do
+        * for normal use.  strace only continues with a signal if the
+        * stopping signal is not SIGTRAP.  -brl
+        */
+       if (current->exit_code) {
+               send_sig(current->exit_code, current, 1);
+               current->exit_code = 0;
+       }
+}
+
 /**
  * tracehook_report_syscall_entry - task is about to attempt a system call
  * @regs:              user register state of current task
@@ -94,6 +117,7 @@ static inline __must_check int tracehook
        if ((task_utrace_flags(current) & UTRACE_EVENT(SYSCALL_ENTRY)) &&
            utrace_report_syscall_entry(regs))
                return 1;
+       ptrace_report_syscall(regs);
        return 0;
 }
 
@@ -118,6 +142,7 @@ static inline void tracehook_report_sysc
 {
        if (task_utrace_flags(current) & UTRACE_EVENT(SYSCALL_EXIT))
                utrace_report_syscall_exit(regs);
+       ptrace_report_syscall(regs);
 }
 
 /**
@@ -179,6 +204,9 @@ static inline void tracehook_report_exec
 {
        if (unlikely(task_utrace_flags(current) & UTRACE_EVENT(EXEC)))
                utrace_report_exec(fmt, bprm, regs);
+       if (!ptrace_event(PT_TRACE_EXEC, PTRACE_EVENT_EXEC, 0) &&
+           unlikely(task_ptrace(current) & PT_PTRACED))
+               send_sig(SIGTRAP, current, 0);
 }
 
 /**
@@ -195,6 +223,7 @@ static inline void tracehook_report_exit
 {
        if (unlikely(task_utrace_flags(current) & UTRACE_EVENT(EXIT)))
                utrace_report_exit(exit_code);
+       ptrace_event(PT_TRACE_EXIT, PTRACE_EVENT_EXIT, *exit_code);
 }
 
 /**
@@ -299,6 +328,8 @@ static inline void tracehook_report_clon
        if (unlikely(task_utrace_flags(current) & UTRACE_EVENT(CLONE)) &&
            (clone_flags & CLONE_VFORK))
                utrace_finish_vfork(current);
+       if (unlikely(trace))
+               ptrace_event(0, trace, pid);
 }
 
 /**
@@ -316,6 +347,7 @@ static inline void tracehook_report_clon
 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);
 }
 
 /**
@@ -369,6 +401,8 @@ static inline void tracehook_signal_hand
 {
        if (task_utrace_flags(current))
                utrace_signal_handler(current, stepping);
+       if (stepping)
+               ptrace_notify(SIGTRAP);
 }
 
 /**

Reply via email to