Re: [PATCH 18/38] C/R: core stuff

From: Alexey Dobriyan
Date: Wed May 27 2009 - 12:28:51 EST


On Fri, May 22, 2009 at 08:55:12AM +0400, Alexey Dobriyan wrote:
> +static int task_struct_restorer(void *_tsk_ctx)
> +{
> + struct task_struct_restore_context *tsk_ctx = _tsk_ctx;
> + struct kstate_image_task_struct *i = tsk_ctx->i;
> + struct kstate_context *ctx = tsk_ctx->ctx;
> + /* In the name of symmetry. */
> + struct task_struct *tsk = current, *real_parent;
> + int rv;
> +
> + pr_debug("%s: ENTER tsk %p/%s\n", __func__, tsk, tsk->comm);
> +
> + write_lock_irq(&tasklist_lock);
> + real_parent = ctx->init_tsk->nsproxy->pid_ns->child_reaper;
> + tsk->real_parent = tsk->parent = real_parent;
> + list_move_tail(&tsk->sibling, &tsk->real_parent->sibling);
^^^^^^^
> + write_unlock_irq(&tasklist_lock);

Eek, what a stupid bug here


commit 2c4b5f5d606a1892b702d95a0e4d29f207685381
Author: Alexey Dobriyan <adobriyan@xxxxxxxxx>
Date: Wed May 27 20:21:59 2009 +0400

C/R: fix stupid bug in reparenting

Child process should be added to ->children list of course

Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>

diff --git a/kernel/kstate/kstate-task.c b/kernel/kstate/kstate-task.c
index 9ed5a19..6df7d25 100644
--- a/kernel/kstate/kstate-task.c
+++ b/kernel/kstate/kstate-task.c
@@ -490,7 +490,7 @@ static int task_struct_restorer(void *_tsk_ctx)
real_parent = tmp->o_obj;
}
tsk->real_parent = tsk->parent = real_parent;
- list_move_tail(&tsk->sibling, &tsk->real_parent->sibling);
+ list_move_tail(&tsk->sibling, &tsk->real_parent->children);
write_unlock_irq(&tasklist_lock);

rv = restore_mm(ctx, &i->ref_mm);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/