diff options
author | Alex Shi <alex.shi@linaro.org> | 2017-05-31 12:02:43 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2017-05-31 12:02:43 +0800 |
commit | a898540914d4136f29bc738ce593c1c501006f23 (patch) | |
tree | 9440b7f76c029143611c89ed919718ba6ff353f4 /kernel/ptrace.c | |
parent | d97f745e1d2fea4d2f308e5e06eee81a9a84f3f5 (diff) | |
parent | 56d847e3ef9433d7ac92376e4ba49d3cf3cb70d2 (diff) |
Merge tag 'v4.1.40' into linux-linaro-lsk-v4.1lsk-v4.1-17.06lsk-v4.1-17.05linux-linaro-lsk-v4.1
This is the 4.1.40 stable release
Diffstat (limited to 'kernel/ptrace.c')
-rw-r--r-- | kernel/ptrace.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index c67aab541ee2..4340fabad1b9 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -152,11 +152,17 @@ static void ptrace_unfreeze_traced(struct task_struct *task) WARN_ON(!task->ptrace || task->parent != current); + /* + * PTRACE_LISTEN can allow ptrace_trap_notify to wake us up remotely. + * Recheck state under the lock to close this race. + */ spin_lock_irq(&task->sighand->siglock); - if (__fatal_signal_pending(task)) - wake_up_state(task, __TASK_TRACED); - else - task->state = TASK_TRACED; + if (task->state == __TASK_TRACED) { + if (__fatal_signal_pending(task)) + wake_up_state(task, __TASK_TRACED); + else + task->state = TASK_TRACED; + } spin_unlock_irq(&task->sighand->siglock); } |