Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84663
b: refs/heads/master
c: d12619b
h: refs/heads/master
i:
  84661: 45917d6
  84659: a75f8f7
  84655: ba55246
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Feb 8, 2008
1 parent bdf52fd commit b16a391
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 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: 430c623121ea88ca80595c99fdc63b7f8a803ae5
refs/heads/master: d12619b5ff5664623524aef796514d1946ea3b4a
1 change: 1 addition & 0 deletions trunk/include/linux/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ extern int show_unhandled_signals;

struct pt_regs;
extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
extern void exit_signals(struct task_struct *tsk);

extern struct kmem_cache *sighand_cachep;

Expand Down
2 changes: 1 addition & 1 deletion trunk/kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ fastcall NORET_TYPE void do_exit(long code)
schedule();
}

tsk->flags |= PF_EXITING;
exit_signals(tsk); /* sets PF_EXITING */
/*
* tsk->flags are checked in the futex code to protect against
* an exiting task cleaning up the robust pi futexes.
Expand Down
27 changes: 26 additions & 1 deletion trunk/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,7 @@ static int do_signal_stop(int signr)
* stop is always done with the siglock held,
* so this check has no races.
*/
if (!t->exit_state &&
if (!(t->flags & PF_EXITING) &&
!task_is_stopped_or_traced(t)) {
stop_count++;
signal_wake_up(t, 0);
Expand Down Expand Up @@ -1900,6 +1900,31 @@ int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka,
return signr;
}

void exit_signals(struct task_struct *tsk)
{
int group_stop = 0;

spin_lock_irq(&tsk->sighand->siglock);
if (unlikely(tsk->signal->group_stop_count) &&
!--tsk->signal->group_stop_count) {
tsk->signal->flags = SIGNAL_STOP_STOPPED;
group_stop = 1;
}

/*
* From now this task is not visible for group-wide signals,
* see wants_signal(), do_signal_stop().
*/
tsk->flags |= PF_EXITING;
spin_unlock_irq(&tsk->sighand->siglock);

if (unlikely(group_stop)) {
read_lock(&tasklist_lock);
do_notify_parent_cldstop(tsk, CLD_STOPPED);
read_unlock(&tasklist_lock);
}
}

EXPORT_SYMBOL(recalc_sigpending);
EXPORT_SYMBOL_GPL(dequeue_signal);
EXPORT_SYMBOL(flush_signals);
Expand Down

0 comments on commit b16a391

Please sign in to comment.