From e179547dfa16841c30d4e039ac64bc9852d6d289 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Mon, 26 Jun 2006 00:26:05 -0700 Subject: [PATCH] --- yaml --- r: 30263 b: refs/heads/master c: aceecc041217b35df753d1ed6e25bd17c0c558d8 h: refs/heads/master i: 30261: c2624bd24f11a8db1f7ad0ec0f7cb0c33eb1bbfc 30259: 3d344595207775c86ad7a93f28b0315953ab5689 30255: 0d8b704726047f4ce6323c491295ebee8223b275 v: v3 --- [refs] | 2 +- trunk/fs/exec.c | 36 ++++++++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/[refs] b/[refs] index 6d3426e4a6e6..718198d02185 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2ceb8693ef63ae3d154ce1a05d275f2bb20a5e4c +refs/heads/master: aceecc041217b35df753d1ed6e25bd17c0c558d8 diff --git a/trunk/fs/exec.c b/trunk/fs/exec.c index fffea1eef8dc..80fe7bcfa094 100644 --- a/trunk/fs/exec.c +++ b/trunk/fs/exec.c @@ -1368,6 +1368,22 @@ static void format_corename(char *corename, const char *pattern, long signr) *out_ptr = 0; } +static void zap_process(struct task_struct *start, int *ptraced) +{ + struct task_struct *t; + + t = start; + do { + if (t != current && t->mm) { + t->mm->core_waiters++; + force_sig_specific(SIGKILL, t); + if (unlikely(t->ptrace) && + unlikely(t->parent->mm == t->mm)) + *ptraced = 1; + } + } while ((t = next_thread(t)) != start); +} + static void zap_threads (struct mm_struct *mm) { struct task_struct *g, *p; @@ -1385,16 +1401,16 @@ static void zap_threads (struct mm_struct *mm) } read_lock(&tasklist_lock); - do_each_thread(g,p) - if (mm == p->mm && p != tsk) { - force_sig_specific(SIGKILL, p); - mm->core_waiters++; - if (unlikely(p->ptrace) && - unlikely(p->parent->mm == mm)) - traced = 1; - } - while_each_thread(g,p); - + for_each_process(g) { + p = g; + do { + if (p->mm) { + if (p->mm == mm) + zap_process(p, &traced); + break; + } + } while ((p = next_thread(p)) != g); + } read_unlock(&tasklist_lock); if (unlikely(traced)) {