Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 106216
b: refs/heads/master
c: 445a91d
h: refs/heads/master
v: v3
  • Loading branch information
Roland McGrath authored and Linus Torvalds committed Jul 26, 2008
1 parent cf66c9b commit 6037f24
Show file tree
Hide file tree
Showing 3 changed files with 27 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: 35de254dc60f91004b3b5ebb1fc7b2c3093d6032
refs/heads/master: 445a91d2fe3667fb8fc251433645f686933cf56a
21 changes: 21 additions & 0 deletions trunk/include/linux/tracehook.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,4 +331,25 @@ static inline int tracehook_consider_ignored_signal(struct task_struct *task,
return (task_ptrace(task) & PT_PTRACED) != 0;
}

/**
* tracehook_consider_fatal_signal - suppress special handling of fatal signal
* @task: task receiving the signal
* @sig: signal number being sent
* @handler: %SIG_DFL or %SIG_IGN
*
* Return nonzero to prevent special handling of this termination signal.
* Normally @handler is %SIG_DFL. It can be %SIG_IGN if @sig is ignored,
* in which case force_sig() is about to reset it to %SIG_DFL.
* When this returns zero, this signal might cause a quick termination
* that does not give the debugger a chance to intercept the signal.
*
* Called with or without @task->sighand->siglock held.
*/
static inline int tracehook_consider_fatal_signal(struct task_struct *task,
int sig,
void __user *handler)
{
return (task_ptrace(task) & PT_PTRACED) != 0;
}

#endif /* <linux/tracehook.h> */
9 changes: 5 additions & 4 deletions trunk/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,12 @@ flush_signal_handlers(struct task_struct *t, int force_default)

int unhandled_signal(struct task_struct *tsk, int sig)
{
void __user *handler = tsk->sighand->action[sig-1].sa.sa_handler;
if (is_global_init(tsk))
return 1;
if (tsk->ptrace & PT_PTRACED)
if (handler != SIG_IGN && handler != SIG_DFL)
return 0;
return (tsk->sighand->action[sig-1].sa.sa_handler == SIG_IGN) ||
(tsk->sighand->action[sig-1].sa.sa_handler == SIG_DFL);
return !tracehook_consider_fatal_signal(tsk, sig, handler);
}


Expand Down Expand Up @@ -761,7 +761,8 @@ static void complete_signal(int sig, struct task_struct *p, int group)
if (sig_fatal(p, sig) &&
!(signal->flags & (SIGNAL_UNKILLABLE | SIGNAL_GROUP_EXIT)) &&
!sigismember(&t->real_blocked, sig) &&
(sig == SIGKILL || !(t->ptrace & PT_PTRACED))) {
(sig == SIGKILL ||
!tracehook_consider_fatal_signal(t, sig, SIG_DFL))) {
/*
* This signal will be fatal to the whole group.
*/
Expand Down

0 comments on commit 6037f24

Please sign in to comment.