Commit f95d39d1 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds
Browse files

do_wait: fix the theoretical race with stop/trace/cont


	current->state = TASK_INTERRUPTIBLE;

	... search for the task to reap ...

In theory, the ->state changing can leak into the critical section.  Since
the child can change its status under read_lock(tasklist) in parallel
(finish_stop/ptrace_stop), we can miss the wakeup if __wake_up_parent()
sees us in TASK_RUNNING state.  Add the barrier.

Also, use __set_current_state() to set TASK_RUNNING.
Signed-off-by: default avatarOleg Nesterov <>
Cc: Ingo Molnar <>
Acked-by: default avatarRoland McGrath <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent a3f6dfb7
......@@ -1581,7 +1581,7 @@ repeat:
(!wo->wo_pid || hlist_empty(&wo->wo_pid->tasks[wo->wo_type])))
goto notask;
current->state = TASK_INTERRUPTIBLE;
tsk = current;
do {
......@@ -1608,7 +1608,7 @@ notask:
current->state = TASK_RUNNING;
if (wo->wo_info) {
struct siginfo __user *infop = wo->wo_info;
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