diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/signal.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index ab6851c06461..62a6c3bb9f0d 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -1733,6 +1733,18 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info) | |||
1733 | } | 1733 | } |
1734 | 1734 | ||
1735 | /* | 1735 | /* |
1736 | * We're committing to trapping. TRACED should be visible before | ||
1737 | * TRAPPING is cleared; otherwise, the tracer might fail do_wait(). | ||
1738 | * Also, transition to TRACED and updates to ->jobctl should be | ||
1739 | * atomic with respect to siglock and should be done after the arch | ||
1740 | * hook as siglock is released and regrabbed across it. | ||
1741 | */ | ||
1742 | set_current_state(TASK_TRACED); | ||
1743 | |||
1744 | current->last_siginfo = info; | ||
1745 | current->exit_code = exit_code; | ||
1746 | |||
1747 | /* | ||
1736 | * If @why is CLD_STOPPED, we're trapping to participate in a group | 1748 | * If @why is CLD_STOPPED, we're trapping to participate in a group |
1737 | * stop. Do the bookkeeping. Note that if SIGCONT was delievered | 1749 | * stop. Do the bookkeeping. Note that if SIGCONT was delievered |
1738 | * while siglock was released for the arch hook, PENDING could be | 1750 | * while siglock was released for the arch hook, PENDING could be |
@@ -1742,21 +1754,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info) | |||
1742 | if (why == CLD_STOPPED && (current->jobctl & JOBCTL_STOP_PENDING)) | 1754 | if (why == CLD_STOPPED && (current->jobctl & JOBCTL_STOP_PENDING)) |
1743 | gstop_done = task_participate_group_stop(current); | 1755 | gstop_done = task_participate_group_stop(current); |
1744 | 1756 | ||
1745 | current->last_siginfo = info; | 1757 | /* entering a trap, clear TRAPPING */ |
1746 | current->exit_code = exit_code; | ||
1747 | |||
1748 | /* | ||
1749 | * TRACED should be visible before TRAPPING is cleared; otherwise, | ||
1750 | * the tracer might fail do_wait(). | ||
1751 | */ | ||
1752 | set_current_state(TASK_TRACED); | ||
1753 | |||
1754 | /* | ||
1755 | * We're committing to trapping. Clearing JOBCTL_TRAPPING and | ||
1756 | * transition to TASK_TRACED should be atomic with respect to | ||
1757 | * siglock. This should be done after the arch hook as siglock is | ||
1758 | * released and regrabbed across it. | ||
1759 | */ | ||
1760 | task_clear_jobctl_trapping(current); | 1758 | task_clear_jobctl_trapping(current); |
1761 | 1759 | ||
1762 | spin_unlock_irq(¤t->sighand->siglock); | 1760 | spin_unlock_irq(¤t->sighand->siglock); |