summaryrefslogtreecommitdiff
path: root/fs/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 24f873e55080..8459791d6bc1 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -685,6 +685,14 @@ static inline int de_thread(struct task_struct *tsk)
*/
ptrace = leader->ptrace;
parent = leader->parent;
+ if (unlikely(ptrace) && unlikely(parent == current)) {
+ /*
+ * Joker was ptracing his own group leader,
+ * and now he wants to be his own parent!
+ * We can't have that.
+ */
+ ptrace = 0;
+ }
ptrace_unlink(current);
ptrace_unlink(leader);