Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1723762

Re: [PATCH] cgroup: Fix potential race between cgroup_exit and migrate path

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] cgroup: Fix potential race between cgroup_exit and migrate path
Date 2017-08-31 03:20 +0200
Message-ID <ukmjf-7nc-1@gated-at.bofh.it> (permalink)
References <ukaL9-8rd-55@gated-at.bofh.it> <uklZT-71i-1@gated-at.bofh.it> <ukm9z-7ka-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Aug 30, 2017 at 06:03:19PM -0700, Tejun Heo wrote:
> Oops, more like the following.
> 
> diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
> index df2e0f1..6f34025 100644
> --- a/kernel/cgroup/cgroup.c
> +++ b/kernel/cgroup/cgroup.c
> @@ -683,7 +683,7 @@ static void css_set_move_task(struct task_struct *task,
>  			if (it->task_pos == &task->cg_list)
>  				css_task_iter_advance(it);
>  
> -		list_del_init(&task->cg_list);
> +		list_del(&task->cg_list);
>  		if (!css_set_populated(from_cset))
>  			css_set_update_populated(from_cset, false);
>  	} else {
> @@ -702,6 +702,8 @@ static void css_set_move_task(struct task_struct *task,
>  		rcu_assign_pointer(task->cgroups, to_cset);
>  		list_add_tail(&task->cg_list, use_mg_tasks ? &to_cset->mg_tasks :
>  							     &to_cset->tasks);
> +	} else {
> +		INIT_LIST_HEAD(&task->cg_list);
>  	}
>  }

On the third thought, I don't think this can happen either because now
migration is strongly synchronized against exits.  Please take a look
at the changes around cgroup_threadgroup_rwsem.

Thanks.

-- 
tejun

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] cgroup: Fix potential race between cgroup_exit and migrate path Neeraj Upadhyay <neeraju@codeaurora.org> - 2017-08-30 15:00 +0200
  Re: [PATCH] cgroup: Fix potential race between cgroup_exit and  migrate path Tejun Heo <tj@kernel.org> - 2017-08-31 03:00 +0200
    Re: [PATCH] cgroup: Fix potential race between cgroup_exit and  migrate path Tejun Heo <tj@kernel.org> - 2017-08-31 03:10 +0200
      Re: [PATCH] cgroup: Fix potential race between cgroup_exit and  migrate path Tejun Heo <tj@kernel.org> - 2017-08-31 03:20 +0200
        Re: [PATCH] cgroup: Fix potential race between cgroup_exit and  migrate path Neeraj Upadhyay <neeraju@codeaurora.org> - 2017-09-04 15:30 +0200

csiph-web