From 955882dc46c84b759944b2c8e12de7eef76c5951 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 25 Jul 2008 19:45:46 -0700 Subject: [PATCH] --- yaml --- r: 106208 b: refs/heads/master c: 30199f5a46aee204bf437a4f5b0740f3efe448b7 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/tracehook.h | 15 +++++++++++++++ trunk/kernel/exit.c | 6 ++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index f06d310e5c4e..67e16835ec64 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ff1188646c6870f336e910fb894eeed74f50471f +refs/heads/master: 30199f5a46aee204bf437a4f5b0740f3efe448b7 diff --git a/trunk/include/linux/tracehook.h b/trunk/include/linux/tracehook.h index 6276353709c1..967ab473afbc 100644 --- a/trunk/include/linux/tracehook.h +++ b/trunk/include/linux/tracehook.h @@ -95,4 +95,19 @@ static inline void tracehook_report_exec(struct linux_binfmt *fmt, send_sig(SIGTRAP, current, 0); } +/** + * tracehook_report_exit - task has begun to exit + * @exit_code: pointer to value destined for @current->exit_code + * + * @exit_code points to the value passed to do_exit(), which tracing + * might change here. This is almost the first thing in do_exit(), + * before freeing any resources or setting the %PF_EXITING flag. + * + * Called with no locks held. + */ +static inline void tracehook_report_exit(long *exit_code) +{ + ptrace_event(PT_TRACE_EXIT, PTRACE_EVENT_EXIT, *exit_code); +} + #endif /* */ diff --git a/trunk/kernel/exit.c b/trunk/kernel/exit.c index ad933bb29ec7..c3691cbc220a 100644 --- a/trunk/kernel/exit.c +++ b/trunk/kernel/exit.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -1029,10 +1030,7 @@ NORET_TYPE void do_exit(long code) if (unlikely(!tsk->pid)) panic("Attempted to kill the idle task!"); - if (unlikely(current->ptrace & PT_TRACE_EXIT)) { - current->ptrace_message = code; - ptrace_notify((PTRACE_EVENT_EXIT << 8) | SIGTRAP); - } + tracehook_report_exit(&code); /* * We're taking recursive faults here in do_exit. Safest is to just