Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 106219
b: refs/heads/master
c: fa00b80
h: refs/heads/master
i:
  106217: c3353da
  106215: cf66c9b
v: v3
  • Loading branch information
Roland McGrath authored and Linus Torvalds committed Jul 26, 2008
1 parent 661d23d commit 4678044
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 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: 7bcf6a2ca5f639b038c48711ebe6c4eca2036641
refs/heads/master: fa00b80b3c41a845b3d56f866fb40a2e98754c51
20 changes: 20 additions & 0 deletions trunk/include/linux/tracehook.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,4 +451,24 @@ static inline int tracehook_get_signal(struct task_struct *task,
return 0;
}

/**
* tracehook_notify_jctl - report about job control stop/continue
* @notify: nonzero if this is the last thread in the group to stop
* @why: %CLD_STOPPED or %CLD_CONTINUED
*
* This is called when we might call do_notify_parent_cldstop().
* It's called when about to stop for job control; we are already in
* %TASK_STOPPED state, about to call schedule(). It's also called when
* a delayed %CLD_STOPPED or %CLD_CONTINUED report is ready to be made.
*
* Return nonzero to generate a %SIGCHLD with @why, which is
* normal if @notify is nonzero.
*
* Called with no locks held.
*/
static inline int tracehook_notify_jctl(int notify, int why)
{
return notify || (current->ptrace & PT_PTRACED);
}

#endif /* <linux/tracehook.h> */
10 changes: 5 additions & 5 deletions trunk/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,6 @@ static int check_kill_permission(int sig, struct siginfo *info,
return security_task_kill(t, info, sig, 0);
}

/* forward decl */
static void do_notify_parent_cldstop(struct task_struct *tsk, int why);

/*
* Handle magic process-wide effects of stop/continue signals. Unlike
* the signal actions, these happen immediately at signal-generation
Expand Down Expand Up @@ -1605,7 +1602,7 @@ finish_stop(int stop_count)
* a group stop in progress and we are the last to stop,
* report to the parent. When ptraced, every thread reports itself.
*/
if (stop_count == 0 || (current->ptrace & PT_PTRACED)) {
if (tracehook_notify_jctl(stop_count == 0, CLD_STOPPED)) {
read_lock(&tasklist_lock);
do_notify_parent_cldstop(current, CLD_STOPPED);
read_unlock(&tasklist_lock);
Expand Down Expand Up @@ -1741,6 +1738,9 @@ int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka,
signal->flags &= ~SIGNAL_CLD_MASK;
spin_unlock_irq(&sighand->siglock);

if (unlikely(!tracehook_notify_jctl(1, why)))
goto relock;

read_lock(&tasklist_lock);
do_notify_parent_cldstop(current->group_leader, why);
read_unlock(&tasklist_lock);
Expand Down Expand Up @@ -1906,7 +1906,7 @@ void exit_signals(struct task_struct *tsk)
out:
spin_unlock_irq(&tsk->sighand->siglock);

if (unlikely(group_stop)) {
if (unlikely(group_stop) && tracehook_notify_jctl(1, CLD_STOPPED)) {
read_lock(&tasklist_lock);
do_notify_parent_cldstop(tsk, CLD_STOPPED);
read_unlock(&tasklist_lock);
Expand Down

0 comments on commit 4678044

Please sign in to comment.