diff options
Diffstat (limited to 'kernel/ptrace.c')
-rw-r--r-- | kernel/ptrace.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 64191fa09b7e..0692ab5a0d67 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -188,7 +188,7 @@ int ptrace_attach(struct task_struct *task) | |||
188 | /* Protect exec's credential calculations against our interference; | 188 | /* Protect exec's credential calculations against our interference; |
189 | * SUID, SGID and LSM creds get determined differently under ptrace. | 189 | * SUID, SGID and LSM creds get determined differently under ptrace. |
190 | */ | 190 | */ |
191 | retval = mutex_lock_interruptible(¤t->cred_exec_mutex); | 191 | retval = mutex_lock_interruptible(&task->cred_exec_mutex); |
192 | if (retval < 0) | 192 | if (retval < 0) |
193 | goto out; | 193 | goto out; |
194 | 194 | ||
@@ -232,7 +232,7 @@ repeat: | |||
232 | bad: | 232 | bad: |
233 | write_unlock_irqrestore(&tasklist_lock, flags); | 233 | write_unlock_irqrestore(&tasklist_lock, flags); |
234 | task_unlock(task); | 234 | task_unlock(task); |
235 | mutex_unlock(¤t->cred_exec_mutex); | 235 | mutex_unlock(&task->cred_exec_mutex); |
236 | out: | 236 | out: |
237 | return retval; | 237 | return retval; |
238 | } | 238 | } |
@@ -604,10 +604,11 @@ repeat: | |||
604 | ret = security_ptrace_traceme(current->parent); | 604 | ret = security_ptrace_traceme(current->parent); |
605 | 605 | ||
606 | /* | 606 | /* |
607 | * Set the ptrace bit in the process ptrace flags. | 607 | * Check PF_EXITING to ensure ->real_parent has not passed |
608 | * Then link us on our parent's ptraced list. | 608 | * exit_ptrace(). Otherwise we don't report the error but |
609 | * pretend ->real_parent untraces us right after return. | ||
609 | */ | 610 | */ |
610 | if (!ret) { | 611 | if (!ret && !(current->real_parent->flags & PF_EXITING)) { |
611 | current->ptrace |= PT_PTRACED; | 612 | current->ptrace |= PT_PTRACED; |
612 | __ptrace_link(current, current->real_parent); | 613 | __ptrace_link(current, current->real_parent); |
613 | } | 614 | } |