Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 106208
b: refs/heads/master
c: 30199f5
h: refs/heads/master
v: v3
  • Loading branch information
Roland McGrath authored and Linus Torvalds committed Jul 26, 2008
1 parent a143731 commit 955882d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ff1188646c6870f336e910fb894eeed74f50471f
refs/heads/master: 30199f5a46aee204bf437a4f5b0740f3efe448b7
15 changes: 15 additions & 0 deletions trunk/include/linux/tracehook.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 /* <linux/tracehook.h> */
6 changes: 2 additions & 4 deletions trunk/kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include <linux/resource.h>
#include <linux/blkdev.h>
#include <linux/task_io_accounting_ops.h>
#include <linux/tracehook.h>

#include <asm/uaccess.h>
#include <asm/unistd.h>
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 955882d

Please sign in to comment.