Change ptrace_report_exec() to use ptrace_event.

Now we should fix EXEC/SYSCALL_EXIT interaction wrt PTRACE_CONT/SYSCALL.

---

 kernel/ptrace.c |   44 +++++++++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 19 deletions(-)

--- PU/kernel/ptrace.c~36_REPORT_EXEC   2009-09-15 15:45:47.000000000 +0200
+++ PU/kernel/ptrace.c  2009-09-15 18:05:42.000000000 +0200
@@ -194,25 +194,6 @@ static u32 utrace_ptrace_event(struct ta
        return utrace_ptrace_report(0, task, event, (event << 8) | SIGTRAP);
 }
 
-static u32 ptrace_report_exec(enum utrace_resume_action action,
-                             struct utrace_engine *engine,
-                             struct task_struct *task,
-                             const struct linux_binfmt *fmt,
-                             const struct linux_binprm *bprm,
-                             struct pt_regs *regs)
-{
-       struct ptrace_context *context = ptrace_context(engine);
-
-       if (context->options & PTRACE_O_TRACEEXEC)
-               return utrace_ptrace_event(task, PTRACE_EVENT_EXEC, 0);
-
-       /*
-        * Old-fashioned ptrace'd exec just posts a plain signal.
-        */
-       send_sig(SIGTRAP, task, 0);
-       return UTRACE_RESUME;
-}
-
 static u32 ptrace_report_exit(enum utrace_resume_action action,
                              struct utrace_engine *engine,
                              struct task_struct *task,
@@ -347,6 +328,31 @@ static u32 ptrace_report_syscall_exit(en
        return UTRACE_STOP;
 }
 
+static u32 ptrace_report_exec(enum utrace_resume_action action,
+                             struct utrace_engine *engine,
+                             struct task_struct *task,
+                             const struct linux_binfmt *fmt,
+                             const struct linux_binprm *bprm,
+                             struct pt_regs *regs)
+{
+       struct ptrace_context *context = ptrace_context(engine);
+       struct ptrace_event *ev;
+
+       if (!(context->options & PTRACE_O_TRACEEXEC)) {
+               /*
+                * Old-fashioned ptrace'd exec just posts a plain signal.
+                */
+               send_sig(SIGTRAP, task, 0);
+               return UTRACE_RESUME;
+       }
+
+       ev = ev_push(context);
+       ev->ev_code = (PTRACE_EVENT_EXEC << 8) | SIGTRAP;
+
+       return UTRACE_STOP;
+}
+
+
 static u32 ptrace_resumed(struct task_struct *task,
                          struct utrace_engine *engine,
                          siginfo_t *info, struct k_sigaction *return_ka)

Reply via email to