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

Alexey Dobriyan adobriyan at gmail.com
Wed May 27 09:28:40 PDT 2009


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 at gmail.com>
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 at gmail.com>

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);
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list