[CRIU] Re: [PATCH cr 5/8] restore: restore sids of tasks, which have been reparented to init

Cyrill Gorcunov gorcunov at openvz.org
Wed Jun 13 07:48:02 EDT 2012


On Wed, Jun 13, 2012 at 03:35:35PM +0400, Andrey Vagin wrote:
> +static int prepare_pstree_ids(void)
> +{
> +	struct pstree_item *pi, *ci, *tmp, *t;
> +	LIST_HEAD(helpers);
> +
> +	/* Some task can be reparented to init. A helper task should be added
> +	 * for restoring sid of such tasks. The helper tasks will be exited
> +	 * immediately after forking children and all children will be
> +	 * reparented to init. */
> +	list_for_each_entry(pi, &root_item->children, list) {
> +		if (pi->sid == root_item->sid || pi->sid == pi->pid)
> +			continue;
> +
> +		tmp = alloc_pstree_item();
> +		tmp->sid = pi->sid;

Andrew, I haven't yet a chance for deep review (will do at evening),
but from a glance alloc_pstree_item may return NULL, so please make
sure we won't be nil dereferencing.

	Cyrill


More information about the CRIU mailing list