Commit b4a9a744 authored by Matt Wilson's avatar Matt Wilson Committed by Linus Torvalds

[PATCH] zap_other_threads() detaches thread group leader

The change to detach the threads in zap_other_threads() broke the case
where the non-thread-group-leader is the cause of de_thread().

In this case the group leader will be detached and freed before
switch_exec_pids() is complete and invalid data will be used.  This is a
patch that makes sure that the group leader does not get detached and
reaped.
parent 736565dc
...@@ -1011,9 +1011,11 @@ void zap_other_threads(struct task_struct *p) ...@@ -1011,9 +1011,11 @@ void zap_other_threads(struct task_struct *p)
* killed as part of a thread group due to another * killed as part of a thread group due to another
* thread doing an execve() or similar. So set the * thread doing an execve() or similar. So set the
* exit signal to -1 to allow immediate reaping of * exit signal to -1 to allow immediate reaping of
* the process. * the process. But don't detach the thread group
* leader.
*/ */
t->exit_signal = -1; if (t != p->group_leader)
t->exit_signal = -1;
sigaddset(&t->pending.signal, SIGKILL); sigaddset(&t->pending.signal, SIGKILL);
rm_from_queue(SIG_KERNEL_STOP_MASK, &t->pending); rm_from_queue(SIG_KERNEL_STOP_MASK, &t->pending);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment