diff options
Diffstat (limited to 'include/linux/tracehook.h')
| -rw-r--r-- | include/linux/tracehook.h | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h index b1875582c1a1..6186a789d6c7 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h | |||
| @@ -272,7 +272,7 @@ static inline void tracehook_finish_clone(struct task_struct *child, | |||
| 272 | * tracehook_report_clone_complete(). This must prevent the child from | 272 | * tracehook_report_clone_complete(). This must prevent the child from |
| 273 | * self-reaping if tracehook_report_clone_complete() uses the @child | 273 | * self-reaping if tracehook_report_clone_complete() uses the @child |
| 274 | * pointer; otherwise it might have died and been released by the time | 274 | * pointer; otherwise it might have died and been released by the time |
| 275 | * tracehook_report_report_clone_complete() is called. | 275 | * tracehook_report_clone_complete() is called. |
| 276 | * | 276 | * |
| 277 | * Called with no locks held, but the child cannot run until this returns. | 277 | * Called with no locks held, but the child cannot run until this returns. |
| 278 | */ | 278 | */ |
| @@ -280,7 +280,7 @@ static inline void tracehook_report_clone(int trace, struct pt_regs *regs, | |||
| 280 | unsigned long clone_flags, | 280 | unsigned long clone_flags, |
| 281 | pid_t pid, struct task_struct *child) | 281 | pid_t pid, struct task_struct *child) |
| 282 | { | 282 | { |
| 283 | if (unlikely(trace)) { | 283 | if (unlikely(trace) || unlikely(clone_flags & CLONE_PTRACE)) { |
| 284 | /* | 284 | /* |
| 285 | * The child starts up with an immediate SIGSTOP. | 285 | * The child starts up with an immediate SIGSTOP. |
| 286 | */ | 286 | */ |
| @@ -487,14 +487,20 @@ static inline int tracehook_notify_jctl(int notify, int why) | |||
| 487 | return notify || (current->ptrace & PT_PTRACED); | 487 | return notify || (current->ptrace & PT_PTRACED); |
| 488 | } | 488 | } |
| 489 | 489 | ||
| 490 | #define DEATH_REAP -1 | ||
| 491 | #define DEATH_DELAYED_GROUP_LEADER -2 | ||
| 492 | |||
| 490 | /** | 493 | /** |
| 491 | * tracehook_notify_death - task is dead, ready to notify parent | 494 | * tracehook_notify_death - task is dead, ready to notify parent |
| 492 | * @task: @current task now exiting | 495 | * @task: @current task now exiting |
| 493 | * @death_cookie: value to pass to tracehook_report_death() | 496 | * @death_cookie: value to pass to tracehook_report_death() |
| 494 | * @group_dead: nonzero if this was the last thread in the group to die | 497 | * @group_dead: nonzero if this was the last thread in the group to die |
| 495 | * | 498 | * |
| 496 | * Return the signal number to send our parent with do_notify_parent(), or | 499 | * A return value >= 0 means call do_notify_parent() with that signal |
| 497 | * zero to send no signal and leave a zombie, or -1 to self-reap right now. | 500 | * number. Negative return value can be %DEATH_REAP to self-reap right |
| 501 | * now, or %DEATH_DELAYED_GROUP_LEADER to a zombie without notifying our | ||
| 502 | * parent. Note that a return value of 0 means a do_notify_parent() call | ||
| 503 | * that sends no signal, but still wakes up a parent blocked in wait*(). | ||
| 498 | * | 504 | * |
| 499 | * Called with write_lock_irq(&tasklist_lock) held. | 505 | * Called with write_lock_irq(&tasklist_lock) held. |
| 500 | */ | 506 | */ |
| @@ -502,7 +508,7 @@ static inline int tracehook_notify_death(struct task_struct *task, | |||
| 502 | void **death_cookie, int group_dead) | 508 | void **death_cookie, int group_dead) |
| 503 | { | 509 | { |
| 504 | if (task->exit_signal == -1) | 510 | if (task->exit_signal == -1) |
| 505 | return task->ptrace ? SIGCHLD : -1; | 511 | return task->ptrace ? SIGCHLD : DEATH_REAP; |
| 506 | 512 | ||
| 507 | /* | 513 | /* |
| 508 | * If something other than our normal parent is ptracing us, then | 514 | * If something other than our normal parent is ptracing us, then |
| @@ -512,21 +518,21 @@ static inline int tracehook_notify_death(struct task_struct *task, | |||
| 512 | if (thread_group_empty(task) && !ptrace_reparented(task)) | 518 | if (thread_group_empty(task) && !ptrace_reparented(task)) |
| 513 | return task->exit_signal; | 519 | return task->exit_signal; |
| 514 | 520 | ||
| 515 | return task->ptrace ? SIGCHLD : 0; | 521 | return task->ptrace ? SIGCHLD : DEATH_DELAYED_GROUP_LEADER; |
| 516 | } | 522 | } |
| 517 | 523 | ||
| 518 | /** | 524 | /** |
| 519 | * tracehook_report_death - task is dead and ready to be reaped | 525 | * tracehook_report_death - task is dead and ready to be reaped |
| 520 | * @task: @current task now exiting | 526 | * @task: @current task now exiting |
| 521 | * @signal: signal number sent to parent, or 0 or -1 | 527 | * @signal: return value from tracheook_notify_death() |
| 522 | * @death_cookie: value passed back from tracehook_notify_death() | 528 | * @death_cookie: value passed back from tracehook_notify_death() |
| 523 | * @group_dead: nonzero if this was the last thread in the group to die | 529 | * @group_dead: nonzero if this was the last thread in the group to die |
| 524 | * | 530 | * |
| 525 | * Thread has just become a zombie or is about to self-reap. If positive, | 531 | * Thread has just become a zombie or is about to self-reap. If positive, |
| 526 | * @signal is the signal number just sent to the parent (usually %SIGCHLD). | 532 | * @signal is the signal number just sent to the parent (usually %SIGCHLD). |
| 527 | * If @signal is -1, this thread will self-reap. If @signal is 0, this is | 533 | * If @signal is %DEATH_REAP, this thread will self-reap. If @signal is |
| 528 | * a delayed_group_leader() zombie. The @death_cookie was passed back by | 534 | * %DEATH_DELAYED_GROUP_LEADER, this is a delayed_group_leader() zombie. |
| 529 | * tracehook_notify_death(). | 535 | * The @death_cookie was passed back by tracehook_notify_death(). |
| 530 | * | 536 | * |
| 531 | * If normal reaping is not inhibited, @task->exit_state might be changing | 537 | * If normal reaping is not inhibited, @task->exit_state might be changing |
| 532 | * in parallel. | 538 | * in parallel. |
