aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/exec.c22
-rw-r--r--include/linux/sched.h3
-rw-r--r--kernel/fork.c2
-rw-r--r--kernel/itimer.c2
-rw-r--r--kernel/signal.c14
5 files changed, 5 insertions, 38 deletions
diff --git a/fs/exec.c b/fs/exec.c
index be923e4bc389..927a7c5ef4af 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -782,26 +782,8 @@ static int de_thread(struct task_struct *tsk)
782 zap_other_threads(tsk); 782 zap_other_threads(tsk);
783 read_unlock(&tasklist_lock); 783 read_unlock(&tasklist_lock);
784 784
785 /* 785 /* Account for the thread group leader hanging around: */
786 * Account for the thread group leader hanging around: 786 count = thread_group_leader(tsk) ? 1 : 2;
787 */
788 count = 1;
789 if (!thread_group_leader(tsk)) {
790 count = 2;
791 /*
792 * The SIGALRM timer survives the exec, but needs to point
793 * at us as the new group leader now. We have a race with
794 * a timer firing now getting the old leader, so we need to
795 * synchronize with any firing (by calling del_timer_sync)
796 * before we can safely let the old group leader die.
797 */
798 sig->tsk = tsk;
799 spin_unlock_irq(lock);
800 if (hrtimer_cancel(&sig->real_timer))
801 hrtimer_restart(&sig->real_timer);
802 spin_lock_irq(lock);
803 }
804
805 sig->notify_count = count; 787 sig->notify_count = count;
806 while (atomic_read(&sig->count) > count) { 788 while (atomic_read(&sig->count) > count) {
807 __set_current_state(TASK_UNINTERRUPTIBLE); 789 __set_current_state(TASK_UNINTERRUPTIBLE);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 3deb6e5d3096..b2d161d87db7 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -460,7 +460,7 @@ struct signal_struct {
460 460
461 /* ITIMER_REAL timer for the process */ 461 /* ITIMER_REAL timer for the process */
462 struct hrtimer real_timer; 462 struct hrtimer real_timer;
463 struct task_struct *tsk; 463 struct pid *leader_pid;
464 ktime_t it_real_incr; 464 ktime_t it_real_incr;
465 465
466 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ 466 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */
@@ -1686,7 +1686,6 @@ extern void block_all_signals(int (*notifier)(void *priv), void *priv,
1686extern void unblock_all_signals(void); 1686extern void unblock_all_signals(void);
1687extern void release_task(struct task_struct * p); 1687extern void release_task(struct task_struct * p);
1688extern int send_sig_info(int, struct siginfo *, struct task_struct *); 1688extern int send_sig_info(int, struct siginfo *, struct task_struct *);
1689extern int send_group_sig_info(int, struct siginfo *, struct task_struct *);
1690extern int force_sigsegv(int, struct task_struct *); 1689extern int force_sigsegv(int, struct task_struct *);
1691extern int force_sig_info(int, struct siginfo *, struct task_struct *); 1690extern int force_sig_info(int, struct siginfo *, struct task_struct *);
1692extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp); 1691extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp);
diff --git a/kernel/fork.c b/kernel/fork.c
index b2ef8e4fad70..ca54d9704644 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -909,7 +909,6 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
909 hrtimer_init(&sig->real_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 909 hrtimer_init(&sig->real_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
910 sig->it_real_incr.tv64 = 0; 910 sig->it_real_incr.tv64 = 0;
911 sig->real_timer.function = it_real_fn; 911 sig->real_timer.function = it_real_fn;
912 sig->tsk = tsk;
913 912
914 sig->it_virt_expires = cputime_zero; 913 sig->it_virt_expires = cputime_zero;
915 sig->it_virt_incr = cputime_zero; 914 sig->it_virt_incr = cputime_zero;
@@ -1338,6 +1337,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1338 if (clone_flags & CLONE_NEWPID) 1337 if (clone_flags & CLONE_NEWPID)
1339 p->nsproxy->pid_ns->child_reaper = p; 1338 p->nsproxy->pid_ns->child_reaper = p;
1340 1339
1340 p->signal->leader_pid = pid;
1341 p->signal->tty = current->signal->tty; 1341 p->signal->tty = current->signal->tty;
1342 set_task_pgrp(p, task_pgrp_nr(current)); 1342 set_task_pgrp(p, task_pgrp_nr(current));
1343 set_task_session(p, task_session_nr(current)); 1343 set_task_session(p, task_session_nr(current));
diff --git a/kernel/itimer.c b/kernel/itimer.c
index 2fab344dbf56..ab982747d9bd 100644
--- a/kernel/itimer.c
+++ b/kernel/itimer.c
@@ -132,7 +132,7 @@ enum hrtimer_restart it_real_fn(struct hrtimer *timer)
132 struct signal_struct *sig = 132 struct signal_struct *sig =
133 container_of(timer, struct signal_struct, real_timer); 133 container_of(timer, struct signal_struct, real_timer);
134 134
135 send_group_sig_info(SIGALRM, SEND_SIG_PRIV, sig->tsk); 135 kill_pid_info(SIGALRM, SEND_SIG_PRIV, sig->leader_pid);
136 136
137 return HRTIMER_NORESTART; 137 return HRTIMER_NORESTART;
138} 138}
diff --git a/kernel/signal.c b/kernel/signal.c
index b0b43a4ad8dd..cc45a6b69134 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1205,20 +1205,6 @@ send_sig(int sig, struct task_struct *p, int priv)
1205 return send_sig_info(sig, __si_special(priv), p); 1205 return send_sig_info(sig, __si_special(priv), p);
1206} 1206}
1207 1207
1208/*
1209 * This is the entry point for "process-wide" signals.
1210 * They will go to an appropriate thread in the thread group.
1211 */
1212int
1213send_group_sig_info(int sig, struct siginfo *info, struct task_struct *p)
1214{
1215 int ret;
1216 read_lock(&tasklist_lock);
1217 ret = group_send_sig_info(sig, info, p);
1218 read_unlock(&tasklist_lock);
1219 return ret;
1220}
1221
1222void 1208void
1223force_sig(int sig, struct task_struct *p) 1209force_sig(int sig, struct task_struct *p)
1224{ 1210{